From 415e32d463bbb881d991d886ddba6f859669c098 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Fri, 19 Oct 2007 11:46:10 +0000 Subject: Bug 399954: Make Bugzilla able to hold its dependencies in a local directory Patch By Max Kanat-Alexander r=LpSolit, a=LpSolit --- importxml.pl | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'importxml.pl') 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; -- cgit v1.2.3-24-g4f1b