31 May 2014 10:55:16 UTC
- Distribution: Config-Param
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (0)
- Testers (247 / 143 / 0)
- KwaliteeBus factor: 0
- 76.27% Coverage
- License: perl_5
- Perl: v5.8.0
- Activity24 month
- Download (46.32KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionTHORGIS Thomas Orgisand 1 contributors
- Thomas Orgis
paramorama - a tool to parse / write Config::Param config files for other programs
script/paramorama [parameters] some.conf [parameters] [param names]
It parses the parameters defined in some.conf to act like the program the file is for when parsing command line parameters that might be following.
Any non-parameter words given after the config file are treated as parameter names to print out the values from. Note that the values are simply printed separated by single line breaks. If parameter values can contain line breaks themselves, the output of multiple parameters is ambiguous. Hash and array parameters are printed one element/pair per line (name=value for hashes). Here, too, line breaks complicate things but the mechanism is useful enough when avoiding such data. For the full deal, you can print and parse the configuration file.
Empty scalars will trigger one empty line of output, empty arrays will trigger _no_ lines of output.
These are the general rules for specifying parameters to this program:
paramorama -s -xyz -s=value --long --long=value [--] [files/stuff]
You mention the parameters/switches you want to change in any order or even multiple times (they are processed in the oder given, later operations overriding/extending earlier settings. An only mentioned short/long name (no "=value") means setting to 1, which is true in the logical sense. Also, prepending + instead of the usual - negates this, setting the value to 0 (false). Specifying "-s" and "--long" is the same as "-s=1" and "--long=1", while "+s" and "++long" is the sames as "-s=0" and "--long=0".
There are also different operators than just "=" available, notably ".=", "+=", "-=", "*=" and "/=" for concatenation / appending array/hash elements and scalar arithmetic operations on the value. Arrays are appended to via "array.=element", hash elements are set via "hash.=name=value". You can also set more array/hash elements by specifying a separator after the long parameter line like this for comma separation
The available parameters are these, default values (in Perl-compatible syntax) at the time of generating this document following the long/short names:
- absolute, a (scalar)
print out absolute file paths
- config, I (array)
Which configfile(s) to use (overriding automatic search in likely paths); special: just -I or --config causes printing a current config file to STDOUT
- help, h (scalar)
show the help message; 1: normal help, >1: more help; "par": help for paramter "par" only
Additional fun with negative values, optionally followed by comma-separated list of parameter names: -1: list par names, -2: list one line per name, -3: -2 without builtins, -10: dump values (Perl style), -11: dump values (lines), -100: print POD.
- includes, i (scalar)
print out list of included config files referenced from the given one (including the primary one)
- verbose (scalar)
- version (scalar)
print out the program version
Thomas Orgis <email@example.com>
Copyright (c) 2012 Thomas Orgis, Free Software licensed under the same terms as Perl 5.10
Module Install Instructions
To install Config::Param, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Config::Param
For more information on module installation, please visit the detailed CPAN module installation guide.