# HG changeset patch # User Heiko Schlittermann # Date 1294785009 -3600 # Node ID 4c0f518fd1bee31f9dfcf9e8b4a032bf197a082b # Parent 8b873567688176dfa8b8fcebfba68c6feaa22118 created lib/DNStools/ as place for my packages diff -r 8b8735676881 -r 4c0f518fd1be dnssec-keytool.pl --- a/dnssec-keytool.pl Mon Jan 03 20:10:17 2011 +0100 +++ b/dnssec-keytool.pl Tue Jan 11 23:30:09 2011 +0100 @@ -9,7 +9,7 @@ use Pod::Usage; use File::Basename; use if $ENV{DEBUG} => "Smart::Comments"; -use dnstools::Config qw(get_config); +use DNStools::Config qw(get_config); my $ME = basename $0; diff -r 8b8735676881 -r 4c0f518fd1be dnstools/Config.pm --- a/dnstools/Config.pm Mon Jan 03 20:10:17 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -package dnstools::Config; -use strict; -use warnings; - -use base "Exporter"; - -our $VERSION = 0.0; -our @EXPORT_OK = qw(get_config); - -sub get_config(@) { - - # read configuration - my @configs = @_; - my %config; - - # the first config FILE - my ($_) = grep { -f } @configs; - open(my $cf, $_) or die "Can't open $_: $!\n"; - - while (<$cf>) { - s/#.*//; - s/\s//g; - next unless length; - my ($cname, $ccont) = split(/\s*=\s*/, $_, 2); - $config{$cname} = $ccont; - } - - # now merge the config hashes - foreach my $o (grep { ref eq "HASH" } @configs) { - %config = - (%config, map { $_ => $o->{$_} } grep { defined $o->{$_} } keys %$o); - } - return %config; -} - -1; diff -r 8b8735676881 -r 4c0f518fd1be lib/DNStools/Config.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/DNStools/Config.pm Tue Jan 11 23:30:09 2011 +0100 @@ -0,0 +1,36 @@ +package DNStools::Config; +use strict; +use warnings; + +use base "Exporter"; + +our $VERSION = 0.0; +our @EXPORT_OK = qw(get_config); + +sub get_config(@) { + + # read configuration + my @configs = @_; + my %config; + + # the first config FILE + my ($_) = grep { -f } @configs; + open(my $cf, $_) or die "Can't open $_: $!\n"; + + while (<$cf>) { + s/#.*//; + s/\s//g; + next unless length; + my ($cname, $ccont) = split(/\s*=\s*/, $_, 2); + $config{$cname} = $ccont; + } + + # now merge the config hashes + foreach my $o (grep { ref eq "HASH" } @configs) { + %config = + (%config, map { $_ => $o->{$_} } grep { defined $o->{$_} } keys %$o); + } + return %config; +} + +1; diff -r 8b8735676881 -r 4c0f518fd1be update-serial.pl --- a/update-serial.pl Mon Jan 03 20:10:17 2011 +0100 +++ b/update-serial.pl Tue Jan 11 23:30:09 2011 +0100 @@ -12,7 +12,7 @@ use IO::File; use POSIX qw(strftime); use if $ENV{DEBUG} => "Smart::Comments"; -use dnstools::Config qw(get_config); +use DNStools::Config qw(get_config); sub uniq(@); sub zones(@); diff -r 8b8735676881 -r 4c0f518fd1be zone-ls.pl --- a/zone-ls.pl Mon Jan 03 20:10:17 2011 +0100 +++ b/zone-ls.pl Tue Jan 11 23:30:09 2011 +0100 @@ -9,7 +9,7 @@ use Time::Local; use Getopt::Long; use if $ENV{DEBUG} => "Smart::Comments"; -use dnstools::Config qw(get_config); +use DNStools::Config qw(get_config); my %config; my $opt_expiry = undef; diff -r 8b8735676881 -r 4c0f518fd1be zone-mk.pl --- a/zone-mk.pl Mon Jan 03 20:10:17 2011 +0100 +++ b/zone-mk.pl Tue Jan 11 23:30:09 2011 +0100 @@ -3,7 +3,7 @@ use warnings; use strict; use FindBin; -use dnstools::Config qw(get_config); +use DNStools::Config qw(get_config); my %config; diff -r 8b8735676881 -r 4c0f518fd1be zone-rm.pl --- a/zone-rm.pl Mon Jan 03 20:10:17 2011 +0100 +++ b/zone-rm.pl Tue Jan 11 23:30:09 2011 +0100 @@ -4,7 +4,7 @@ use strict; use File::Path; use FindBin; -use dnstools::Config qw(get_config); +use DNStools::Config qw(get_config); # liest die Konfiguration ein my %config = get_config("$FindBin::Bin/dnstools.conf", "/etc/dnstools.conf");