LiCoM::Config: Read the file `licom.conf' in the script's directory too, if it exists.
authorFlorian Forster <octo@verplant.org>
Mon, 11 Sep 2006 21:16:40 +0000 (23:16 +0200)
committerFlorian Forster <octo@verplant.org>
Mon, 11 Sep 2006 21:16:40 +0000 (23:16 +0200)
lib/LiCoM/Config.pm

index 295f7eb..be8359f 100644 (file)
@@ -4,6 +4,8 @@ use strict;
 use warnings;
 use Carp (qw(cluck confess));
 
+use File::Basename (qw(dirname));
+
 use Exporter;
 
 @LiCoM::Config::EXPORT_OK = (qw(get_config set_config read_config));
@@ -72,6 +74,10 @@ sub read_config
        {
                push (@files, $ENV{'HOME'} . '/.licomrc');
        }
+       elsif (defined ($ENV{'SCRIPT_FILENAME'}))
+       {
+               push (@files, dirname ($ENV{'SCRIPT_FILENAME'}) . '/licom.conf');
+       }
 
        for (@files)
        {