diff -r ac04894f45c1 -r fc2156761c29 lib/DNStools/Config.pm --- a/lib/DNStools/Config.pm Thu Jan 13 00:27:30 2011 +0100 +++ b/lib/DNStools/Config.pm Fri Jan 14 22:12:24 2011 +0100 @@ -1,4 +1,5 @@ package DNStools::Config; + use strict; use warnings; @@ -15,6 +16,8 @@ # the first config FILE my ($_) = grep { -f } @configs; + + die "no config file found, searched for @configs\n" if not $_; open(my $cf, $_) or die "Can't open $_: $!\n"; while (<$cf>) { @@ -34,3 +37,38 @@ } 1; + +__END__ + +=head1 NAME + + DNStools::Config - config parser + +=head1 SYNOPSIS + + use DNStools::Config qw(get_config); + %config = get_config($file1, $file2, ...); + +=head1 DESCRIPTION + +Simple config file parser. The format is simple: + + key = value + +All spaces are ignored. + +=head1 FUNCTIONS + +=over + +=item B(I) + +Read the first file of the list (or dies if none of the files is found). +Returns a hash with the config keys and values. + +=back + +=cut + + +