commit: d485ef42ae4a6374e6215a3fa3e70d2ad06a4085
Author: Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> gentoo
<DOT> org>
AuthorDate: Sun Jun 19 12:13:03 2016 +0000
Commit: Jorge Manuel B. S. Vicetto <jmbsvicetto <AT> gentoo <DOT> org>
CommitDate: Sun Jun 19 12:13:03 2016 +0000
URL: https://gitweb.gentoo.org/proj/elections.git/commit/?id=d485ef42
Allow running listify and statify outside of /etc/elections and the repository
dir.
Signed-off-by: Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT>
gentoo.org>
listify | 7 +++++--
statify | 9 ++++++---
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/listify b/listify
index c8c24eb..7ca2bc3 100755
--- a/listify
+++ b/listify
@@ -8,11 +8,14 @@
#
BEGIN {
+ my $dirname;
if(-f '/etc/elections/Votify.pm') {
- push @INC, '/etc/elections';
+ $dirname = '/etc/elections';
} else {
- push @INC, '.' if -f 'Votify.pm';
+ use File::Basename;
+ $dirname = dirname(__FILE__);
}
+ push @INC, $dirname;
}
use POSIX;
diff --git a/statify b/statify
index c424696..a26a066 100755
--- a/statify
+++ b/statify
@@ -8,12 +8,15 @@
# statify: Produce early election statistics
#
-BEGIN {
+BEGIN {
+ my $dirname;
if(-f '/etc/elections/Votify.pm') {
- push @INC, '/etc/elections';
+ $dirname = '/etc/elections';
} else {
- push @INC, '.' if -f 'Votify.pm';
+ use File::Basename;
+ $dirname = dirname(__FILE__);
}
+ push @INC, $dirname;
}
use POSIX;