CGI::Ex::Conf 2.06 review

Download
by rbytes.net on

CGI::Ex::Conf is a Perl module with Conf Reader/Writer for many different data format types. SYNOPSIS use CGI::Ex::Conf qw(

License: Perl Artistic License
File size: 213K
Developer: Paul Seamons
0 stars award from rbytes.net

CGI::Ex::Conf is a Perl module with Conf Reader/Writer for many different data format types.

SYNOPSIS

use CGI::Ex::Conf qw(conf_read conf_write);

my $hash = conf_read("/tmp/foo.yaml");

conf_write("/tmp/foo.yaml", {key1 => $val1, key2 => $val2});


### OOP interface

my $cob = CGI::Ex::Conf->new;

my $full_path_to_file = "/tmp/foo.val"; # supports ini, sto, val, pl, xml
my $hash = $cob->read($file);

local $cob->{default_ext} = 'conf'; # default anyway


my @paths = qw(/tmp, /home/pauls);
local $cob->{paths} = @paths;
my $hash = $cob->read('My::NameSpace');
# will look in /tmp/My/NameSpace.conf and /home/pauls/My/NameSpace.conf


my $hash = $cob->read('My::NameSpace', {paths => ['/tmp']});
# will look in /tmp/My/NameSpace.conf


local $cob->{directive} = 'MERGE';
my $hash = $cob->read('FooSpace');
# OR #
my $hash = $cob->read('FooSpace', {directive => 'MERGE'});
# will return merged hashes from /tmp/FooSpace.conf and /home/pauls/FooSpace.conf
# immutable keys are preserved from originating files


local $cob->{directive} = 'FIRST';
my $hash = $cob->read('FooSpace');
# will return values from first found file in the path.


local $cob->{directive} = 'LAST'; # default behavior
my $hash = $cob->read('FooSpace');
# will return values from last found file in the path.


### manipulate $hash
$cob->write('FooSpace'); # will write it out the changes

There are half a million Conf readers out there. Why not add one more. Actually, this module provides a wrapper around the many file formats and the config modules that can handle them. It does not introduce any formats of its own.

This module also provides a preload ability which is useful in conjunction with mod_perl.

Requirements:
Perl

CGI::Ex::Conf 2.06 keywords