page6
Pass Arguments to your Perlscript
Like every other SCR agent your perl script gets three arguments:
Have a look to SCR main page for additional details.
1.The function type: Dir, Read, Write or Execute
Your Script should support Dir if it supports subpaths!
Your working procedures should support Read/Write if your task is
typical Read/Write operation. Otherwise use Execute. You can write
a agent, which supports all function types!
Using the right function type, only increases the
usabilty of your agent. For the functionality the choosen type it is not relevant.
Technically you can write a Read agent, that writes something.
The following functions check the Command:
ycpGetCommand
ycpCommandIsRead
ycpCommandIsWrite
ycpCommandIsExecute);
The subpath:
The subpath is important for complex agents, which do something
in different regions
Typically the agent is called with .<mount point> and you get only . for the subpath
If your agent is mounted e.g. on .disks and the calling function
sends .disks.hda you get only the .hda .
The following functions you can get the current path:
ycpGetPath
optional: The value:
Here you can pass any YCP value to the perl script.
The current convenience functions support a list, a map,
a string or an integer as value.
This value is typically the argument for your script.
Check the type of the argument with the following functions:
ycpGetArgType
ycpArgIsMap
ycpArgIsList
ycpArgIsInteger
ycpArgIsString
ycpArgIsNil
ycpArgIsNone
Read the argument:
ycpGetArgMap
ycpGetArgList
ycpGetArgString
ycpGetArgInteger