NAME
Tie::Cfg - Ties simple configuration files to hashes.
SYNOPSIS
use Tie::Cfg;
tie my %conf, 'Tie::Cfg',
READ => "/etc/connect.cfg",
WRITE => "/etc/connect.cfg",
MODE => 0600,
LOCK => 1;
$conf{test}="this is a test";
untie %conf;
my $limit="10000k";
tie my %files, 'Tie::Cfg',
READ => "find $dirs -xdev -type f -size +$limit -printf \"%h/%f:%k\\n\" |";
$conf{test}="this is a test";
if (exists $files{"/etc/passwd"}) {
print "You've got a /etc/passwd file!\n";
}
while (($file,$size) = each %newdb) {
print "Wow! Another file bigger than $limit ($size)\n";
}
untie %files;
DESCRIPTION
This module reads in a configuration file at 'tie' and writes it at 'untie'. You can use file locking to prevent others from accessing the configuration file, but this should only be used if the configuration file is used as a kind of a database to hold a few entries that can be concurrently accessed.
Mode is used to set access permissions; defaults to 0640. It's only set if a file can be written (i.e. using the WRITE keyword).
AUTHOR
Hans Oesterholt-Dijkema <hans@oesterholt-dijkema.emailt.nl>
BUGS
Possibly.
LICENCE
Perl.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 182:
'=end' without a target?