NAME
Bio::Polloc::Polloc::Config - Handles .cfg files
AUTHOR - Luis M. Rodriguez-R
Email lmrodriguezr at gmail dot com
DESCRIPTION
See the scripts folder (.bme files) for examples of the expected syntaxis.
GLOBALS
Global variables controling the behavior of the package
- CFGMAXDEPTH
-
Maximum depth of variables replacement
- CFGCURDEPTH
-
Current depth of replacement (internal var)
APPENDIX
Methods provided by the package
new
Initialization method.
Arguments
- -spaces arr of str
-
A reference to an array of strings, each containing a namespace to be parsed.
- -noparse bool (int)
-
If set to true, does not automatically parse the file on creation. If so, the parse function must be manually called.
parse
Parses the configuration file.
Throws
Bio::Polloc::Polloc::IOException on parsing error.
spaces
Gets/sets the spaces to be parsed.
value
Gets the value of a given key.
Arguments
Throws
Bio::Polloc::Polloc::Error If not found and mandatory.
all_keys
Gets all the stored keys.
Arguments
Returns
All the keys within the space (array of str).
alias
A key by alias.
Arguments
Throws
Bio::Polloc::Polloc::Error if any of the two keys is empty.
INTERNAL METHODS
Methods intended to be used only within the scope of Bio::Polloc::*
_filter_line
Removes comments from lines and lines with spaces only.
_save
Saves a key/value pair.
Arguments
Returns
The (uniform) key of the saved pair. If array or list, the key and the value.
_parse_space
Parses (cleans) the name of a namespace.
Arguments
The namespace to parse.
Returns
The parsed (uniform) namespace.
_space_required
Indicates whether a namespace is required. I.e., if the user explicitly requiested the space, any child or any parent.
Arguments
The namespace.
Returns
Boolean (int).
_execute_token
Executes a token expected to map to a function.
Arguments
_execute_postparse
Executes registered functions to be launched once parsing is finnished.
_register_handle_function
Register a handle function (for tokens).
Arguments
- -token str
-
Token (can contain namespace).
- -obj ref to obj
-
Reference to the object *containing* the function.
- -fun str
-
Name of the function (note that this is the name of the function within the object, not a reference to the function itself).
- -defaults ref to arr
-
Default parameters to be passed to the function after the body.
- -space str
-
Namespace of the token.
_register_postparse_function
Registers a function to be launched once parsing is complete.
Arguments
_handle_functions
Gets the collection of functions to handle tokens.
_postparse_functions
Gets the collection of functions to be launched after parsing.
_get_handle_function
_reparse
Parses recursively all values until no references to other vars last or the maximum depth is reached, whatever happens first.
_parse_key
Parses a key and returns its uniform name.
Arguments
_key_alias
Creates an alias for a key based on a string input. See alias.
Arguments
A string containing the name of the from key, one or more spaces and the name of the to string. Can contain surrounding spaces.
Throws
Bio::Polloc::Polloc::Error if empty string or not properly formatted.
_initialize
21 POD Errors
The following errors were encountered while parsing the POD:
- Around line 62:
Expected '=item *'
- Around line 97:
Expected '=item *'
- Around line 174:
Expected '=item *'
- Around line 196:
Expected '=item *'
- Around line 230:
Expected '=item *'
- Around line 240:
Expected '=item *'
- Around line 264:
Expected '=item *'
- Around line 278:
Expected '=item *'
- Around line 339:
Expected '=item *'
- Around line 358:
Expected '=item *'
- Around line 404:
Expected '=item *'
- Around line 408:
Expected '=item *'
- Around line 434:
Expected '=item *'
- Around line 438:
Expected '=item *'
- Around line 473:
Expected '=item *'
- Around line 559:
Expected '=item *'
- Around line 610:
Expected '=item *'
- Around line 684:
Expected '=item *'
- Around line 750:
Expected '=item *'
- Around line 792:
Expected '=item *'
- Around line 797:
Expected '=item *'