LiCoM::Config: Read the file `licom.conf' in the script's directory too, if it exists.
[licom.git] / 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)
        {