|
Config::Mini - Very simple INI-style configuration parser |
Config::Mini - Very simple INI-style configuration parser
In your config file:
foo = bar baz = buz
[section1] key1 = val1 key2 = val2
[section2] key3 = val3 key4 = arrayvalue key4 = arrayvalue2 key4 = arrayvalue3
In your perl code:
use Config::Mini; Config::Mini::parse_file ('sample.cfg');
my $foo = Config::Mini::get (``general'', ``foo''); my @key4 = Config::Mini::get (``section2'', ``key4'');
Config::Mini is a very simple INI style parser.
Parses config file $filename
Parses @data
Returns the value for $key in $context.
Returns the value as an array if the requested value is an array.
Return the first value otherwise.
If $context is used to describe an object, Config::Mini will try to instantiate it.
If $section contains a ``package'' attribute, Config::Mini will try to load that package and call
a new() method to instantiate the object.
Otherwise, it will simply return a hash reference.
Values can be considered as a scalar or an array. Hence, Config::Mini uses <attribute_name> for scalar values and '__<attribute_name>' for array values.
Selects all section entries matching $regex, and returns a list of instantiated
objects using instantiate() for each of them.
Copyright 2006 - Jean-Michel Hiver All rights reserved
This module is free software and is distributed under the same license as Perl itself. Use it at your own risk.
|
Config::Mini - Very simple INI-style configuration parser |