changeset 48:96ee35378696

modified for searching configuration files
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sat, 18 Oct 2008 21:23:09 +0800
parents 9466964ae5bb
children 7f935bdc01b6 bc31729f29f4
files Ikariam.pm scan.pl
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Ikariam.pm	Fri Oct 17 14:06:31 2008 +0800
+++ b/Ikariam.pm	Sat Oct 18 21:23:09 2008 +0800
@@ -1,7 +1,8 @@
 #!/usr/bin/env perl
 BEGIN {
-    my $HOME = (getpwuid($<))[7] || $ENV{HOME} || $ENV{LOGDIR} || ".";
-    require "$HOME/.eagleeye.pm";
+    foreach (((getpwuid($<))[7], $ENV{HOME}, $ENV{LOGDIR}, ".")) {
+        require "$_/.eagleeye.pm" if (-f "$_/.eagleeye.pm");
+    }
 }
 
 use Class::DBI::AutoLoader (
--- a/scan.pl	Fri Oct 17 14:06:31 2008 +0800
+++ b/scan.pl	Sat Oct 18 21:23:09 2008 +0800
@@ -8,7 +8,10 @@
 {
     my ($island, @cities) = @_;
 
-    die ("empty cities list.\n") if ($#cities == -1);
+    if ($#cities == -1) {
+        warn ("empty cities list.\n");
+        return;
+    }
 
     foreach my $city (@cities)
     {