From: Byron Jones Date: Fri, 25 Feb 2011 04:42:17 +0000 (+0800) Subject: Bug 621925: Avoid 'used only once' warning when loading extensions X-Git-Tag: bugzilla-4.1.1~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1dcf3b12df00659121bcfb7718297f2a578661f;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 ef71f5b75b..c8d3d8eb41 100644 --- a/Bugzilla/Install/Util.pm +++ b/Bugzilla/Install/Util.pm @@ -222,8 +222,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); }