aboutsummaryrefslogtreecommitdiffstats
path: root/importxml.pl
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2007-10-19 11:46:10 +0000
committermkanat%bugzilla.org <>2007-10-19 11:46:10 +0000
commit415e32d463bbb881d991d886ddba6f859669c098 (patch)
treefd97f6e5bd6f2333f9c9dceda58f5ba226d3bc4a /importxml.pl
parentc6ede85fc67cefea141519c2b767cdcc600995ee (diff)
downloadbugs-415e32d463bbb881d991d886ddba6f859669c098.tar
bugs-415e32d463bbb881d991d886ddba6f859669c098.tar.gz
bugs-415e32d463bbb881d991d886ddba6f859669c098.tar.bz2
bugs-415e32d463bbb881d991d886ddba6f859669c098.tar.xz
bugs-415e32d463bbb881d991d886ddba6f859669c098.zip
Bug 399954: Make Bugzilla able to hold its dependencies in a local directory
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'importxml.pl')
-rwxr-xr-ximportxml.pl20
1 files changed, 7 insertions, 13 deletions
diff --git a/importxml.pl b/importxml.pl
index 9ef8150f6..80506971c 100755
--- a/importxml.pl
+++ b/importxml.pl
@@ -54,22 +54,16 @@ use strict;
#
#####################################################################
-# figure out which path this script lives in. Set the current path to
-# this and add it to @INC so this will work when run as part of mail
-# alias by the mailer daemon
-# since "use lib" is run at compile time, we need to enclose the
-# $::path declaration in a BEGIN block so that it is executed before
-# the rest of the file is compiled.
+use File::Basename qw(dirname);
+# MTAs may call this script from any directory, but it should always
+# run from this one so that it can find its modules.
BEGIN {
- $::path = $0;
- $::path =~ m#(.*)/[^/]+#;
- $::path = $1;
- $::path ||= '.'; # $0 is empty at compile time. This line will
- # have no effect on this script at runtime.
+ require File::Basename;
+ my $dir = $0; $dir =~ /(.*)/; $dir = $1; # trick taint
+ chdir(File::Basename::dirname($dir));
}
-chdir $::path;
-use lib ($::path);
+use lib qw(. lib);
# Data dumber is used for debugging, I got tired of copying it back in
# and then removing it.
#use Data::Dumper;