diff options
author | David Lawrence <dkl@mozilla.com> | 2015-04-13 15:59:31 +0200 |
---|---|---|
committer | David Lawrence <dkl@mozilla.com> | 2015-04-13 15:59:31 +0200 |
commit | d6c2d37b69eb19b0f0136112d1da45dadb42cbb4 (patch) | |
tree | 34f58b12c337f0d7810d95d3ea22c6ce772c2d91 /Bugzilla/API/Server.pm | |
parent | 7d0c10e71498f2909f466fc0ccda1890595bd3ff (diff) | |
download | bugzilla-d6c2d37b69eb19b0f0136112d1da45dadb42cbb4.tar.gz bugzilla-d6c2d37b69eb19b0f0136112d1da45dadb42cbb4.tar.xz |
Bug 1153125: bug 1051056 causes "Constant subroutine redefined" warnings during t/001compile.t
r=LpSolit,a=glob
Diffstat (limited to 'Bugzilla/API/Server.pm')
-rw-r--r-- | Bugzilla/API/Server.pm | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Bugzilla/API/Server.pm b/Bugzilla/API/Server.pm index 439f6e743..496901037 100644 --- a/Bugzilla/API/Server.pm +++ b/Bugzilla/API/Server.pm @@ -95,25 +95,26 @@ sub server { sub constants { my ($self) = @_; - my $api_version = $self->api_version; + return $self->{_constants} if defined $self->{_constants}; no strict 'refs'; + my $api_version = $self->api_version; my $class = "Bugzilla::API::${api_version}::Constants"; require_module($class); - my %constants; - foreach my $constant (@{$class . "::EXPORT"}, @{$class . "::EXPORT_OK"}) { + $self->{_constants} = {}; + foreach my $constant (@{$class . "::EXPORT_OK"}) { if (ref $class->$constant) { - $constants{$constant} = $class->$constant; + $self->{_constants}->{$constant} = $class->$constant; } else { my @list = ($class->$constant); - $constants{$constant} = (scalar(@list) == 1) ? $list[0] : \@list; + $self->{_constants}->{$constant} = (scalar(@list) == 1) ? $list[0] : \@list; } } - return \%constants; + return $self->{_constants}; } sub response_header { |