EWS::variables provides object-oriented access to contained objects (variables). Variable-named attributes (i.e. - attribute methods with the same name as a contained variable) provide direct access to contained variables.
Variables may be created as read-write (can be changed) or read-only (unable to be changed).
alias declarations allow virtual variables (aliases) to be substituted for actual variables. Alias-named attributes (i.e. - attribute methods with the same name as an alias) provide indirect access to contained variables.
Application command-line switches and environment variables are automatically parsed into the variableHash upon object creation (new). Command-line switch names are added without modification (e.g. the switch -d is added as the variable d). Environment variables have ENV_ prepended to the environment variable (e.g. - the environment variable HOME is added as the variable ENV_HOME).
Additional variables must be explictly created. Care must be taken to avoid name conflicts. Creation of a unique namespace by prepending variable names with a namespace name (e.g. - ENV for environment variables) is a simple form of conflict prevention.
EWS::variables provides the following class methods and attributes:
| Public Methods | Description |
|---|---|
| new | Returns a blessed reference to a new variables object. |
| alias | Create a link to a variable in the variable hash. |
| coerce | Change the declared variable type, if possible. |
| create | Create a variable in the variable hash. |
| delete | Delete a variable from the variable hash. |
| Public Attributes | Description |
|---|---|
| aliasHash | Return the alias hash. |
| aliasHashRef | Return a reference to the alias hash. |
| array | Get/set the array element value. |
| arrayref | Return a reference to the requested array. |
| callback | Set callback attribute method for the specified variable. |
| hash | Get/set the key/value in the specified hash. |
| hashref | Return a reference to the requested hash. |
| pop | Pop the value off of the specified array. |
| push | Push the value on to the specified array. |
| readonly | Return the readonly status of the specified variable. |
| ref | Ref returns the type of variable. |
| Revision | Returns the revision number. |
| scalar | Return the number of items in the specified array. |
| shift | Shift the first value off of the specified array. |
| value | Get/set variable value. |
| variableExists | Check if variable exists. |
| variableHash | Return the variable hash. |
| variableHashRef | Return a reference to the variable hash. |
| Version | Returns the version number of cookies.pm. |