From: Byron Jones Date: Fri, 25 Feb 2011 04:45:57 +0000 (+0800) Subject: Bug 621925: Avoid 'used only once' warning when loading extensions X-Git-Tag: bugzilla-4.0.1~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e25633aec8f0ef1a9311e3950cb620a20a517dac;p=thirdparty%2Fbugzilla.git Bug 621925: Avoid 'used only once' warning when loading extensions r=mkanat, a=mkanat --- diff --git a/Bugzilla/Install/Util.pm b/Bugzilla/Install/Util.pm index 2c651988b3..69da508fb1 100644 --- a/Bugzilla/Install/Util.pm +++ b/Bugzilla/Install/Util.pm @@ -221,8 +221,14 @@ sub extension_package_directory { my ($invocant, $file) = @_; my $class = ref($invocant) || $invocant; + # $file is set on the first invocation, store the value in the extension's + # package for retrieval on subsequent calls my $var; - { no strict 'refs'; $var = \${"${class}::EXTENSION_PACKAGE_DIR"}; } + { + no warnings 'once'; + no strict 'refs'; + $var = \${"${class}::EXTENSION_PACKAGE_DIR"}; + } if ($file) { $$var = dirname($file); }