summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2016-12-23 02:35:20 +0100
committerDylan William Hardison <dylan@hardison.net>2017-02-20 23:22:01 +0100
commit65bbd453dc8cedef86af52a37dd84ed0257acb62 (patch)
treeab4915abc9363c1cb82b0c273b79566be1c51167
parentfab635c61770842a43d6241bcee68d95034309f8 (diff)
downloadbugzilla-65bbd453dc8cedef86af52a37dd84ed0257acb62.tar.gz
bugzilla-65bbd453dc8cedef86af52a37dd84ed0257acb62.tar.xz
Bug 1301383 - Memoize does not work under threaded perl in windows: "Anonymous function called in forbidden scalar context"
-rw-r--r--Bugzilla/Constants.pm13
1 files changed, 6 insertions, 7 deletions
diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm
index 2e3f339a7..7a48995da 100644
--- a/Bugzilla/Constants.pm
+++ b/Bugzilla/Constants.pm
@@ -15,7 +15,6 @@ use parent qw(Exporter);
# For bz_locations
use File::Basename;
-use Memoize;
@Bugzilla::Constants::EXPORT = qw(
BUGZILLA_VERSION
@@ -641,9 +640,13 @@ use constant EMAIL_LIMIT_EXCEPTION => "email_limit_exceeded\n";
use constant JOB_QUEUE_VIEW_MAX_JOBS => 500;
sub bz_locations {
- # Force memoize() to re-compute data per project, to avoid
+ # Force $memoize to re-compute data per project, to avoid
# sharing the same data across different installations.
- return _bz_locations($ENV{'PROJECT'});
+ state $memoize = {};
+ my $project = $ENV{PROJECT};
+ my $key = $project // '__DEFAULT';
+
+ return $memoize->{$key} //= _bz_locations($project);
}
sub _bz_locations {
@@ -704,10 +707,6 @@ sub _bz_locations {
};
}
-# This makes us not re-compute all the bz_locations data every time it's
-# called.
-BEGIN { memoize('_bz_locations') };
-
1;
=head1 B<Methods in need of POD>