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 options to change parameters in any order or even multiple times. They are processed in the oder given, later operations overriding/extending earlier settings. Using the separator "--" stops option parsing 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:
--array/,/=1,2,3 --hash/,/=name=val,name2=val2
The available parameters are these, default values (in Perl-compatible syntax) at the time of generating this document following the long/short names:
0
print out absolute file paths
[]
Which configfile(s) to use (overriding automatic search in likely paths); special: just -I or --config causes printing a current config file to STDOUT
Show the help message. Value 1..9: help level, par: help for paramter par (long name) 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.
print out list of included config files referenced from the given one (including the primary one)
be outspoken
print out the program version
Thomas Orgis <thomas@orgis.org>
Copyright (c) 2012 Thomas Orgis, Free Software licensed under the same terms as Perl 5.10
Copyright (c) 2022 Thomas Orgis, Free Software licensed under the same terms as Perl 5.10
To install Config::Param, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Config::Param
CPAN shell
perl -MCPAN -e shell install Config::Param
For more information on module installation, please visit the detailed CPAN module installation guide.