lib/DNStools/Config.pm
branchhs12
changeset 85 c47953192c5c
parent 80 fc2156761c29
child 87 6d624831079f
--- a/lib/DNStools/Config.pm	Sun Jan 16 17:28:48 2011 +0100
+++ b/lib/DNStools/Config.pm	Sun Jan 16 17:29:01 2011 +0100
@@ -11,7 +11,13 @@
 sub get_config(@) {
 
     # read configuration
-    my @configs = @_;
+    my @configs =
+        @_
+      ? @_
+      : (
+        $ENV{DNSTOOLS_CONF},         "dnstools.conf",
+        "$ENV{HOME}/.dnstools.conf", "/etc/dnstools.conf"
+      );
     my %config;
 
     # the first config FILE
@@ -47,6 +53,7 @@
 =head1 SYNOPSIS
 
     use DNStools::Config qw(get_config);
+    %config = get_config();
     %config = get_config($file1, $file2, ...);
 
 =head1 DESCRIPTION
@@ -66,6 +73,10 @@
 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.
 
+If the list is empty, the configuration file is search in some default
+locations: C<$DNSTOOLS_CONF>, F<./dnstools.conf>,
+F<$HOME/.dnstools.conf>, F</etc/dnstools.conf>.
+
 =back
 
 =cut