From d6c2d37b69eb19b0f0136112d1da45dadb42cbb4 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Mon, 13 Apr 2015 14:59:31 +0100 Subject: Bug 1153125: bug 1051056 causes "Constant subroutine redefined" warnings during t/001compile.t r=LpSolit,a=glob --- Bugzilla/API/1_0/Constants.pm | 2 +- Bugzilla/API/1_0/Resource/Bug.pm | 2 +- Bugzilla/API/1_0/Resource/Component.pm | 2 +- Bugzilla/API/1_0/Resource/FlagType.pm | 2 +- Bugzilla/API/1_0/Resource/Group.pm | 2 +- Bugzilla/API/1_0/Resource/Product.pm | 2 +- Bugzilla/API/1_0/Resource/User.pm | 2 +- Bugzilla/API/1_0/Server.pm | 2 +- Bugzilla/API/1_0/Util.pm | 2 +- Bugzilla/API/Server.pm | 13 +++++++------ 10 files changed, 16 insertions(+), 15 deletions(-) (limited to 'Bugzilla/API') diff --git a/Bugzilla/API/1_0/Constants.pm b/Bugzilla/API/1_0/Constants.pm index caf670c7b..44e20124a 100644 --- a/Bugzilla/API/1_0/Constants.pm +++ b/Bugzilla/API/1_0/Constants.pm @@ -15,7 +15,7 @@ use Bugzilla::Hook; use parent qw(Exporter); -our @EXPORT = qw( +our @EXPORT_OK = qw( WS_ERROR_CODE STATUS_OK diff --git a/Bugzilla/API/1_0/Resource/Bug.pm b/Bugzilla/API/1_0/Resource/Bug.pm index c61b2c6c2..8bdf9ae2d 100644 --- a/Bugzilla/API/1_0/Resource/Bug.pm +++ b/Bugzilla/API/1_0/Resource/Bug.pm @@ -11,7 +11,7 @@ use 5.10.1; use strict; use warnings; -use Bugzilla::API::1_0::Constants; +use Bugzilla::API::1_0::Constants qw(STATUS_CREATED); use Bugzilla::API::1_0::Util; use Bugzilla::Comment; diff --git a/Bugzilla/API/1_0/Resource/Component.pm b/Bugzilla/API/1_0/Resource/Component.pm index c3bdc0386..96c2a3dcd 100644 --- a/Bugzilla/API/1_0/Resource/Component.pm +++ b/Bugzilla/API/1_0/Resource/Component.pm @@ -11,7 +11,7 @@ use 5.10.1; use strict; use warnings; -use Bugzilla::API::1_0::Constants; +use Bugzilla::API::1_0::Constants qw(STATUS_CREATED); use Bugzilla::API::1_0::Util; use Bugzilla::Component; diff --git a/Bugzilla/API/1_0/Resource/FlagType.pm b/Bugzilla/API/1_0/Resource/FlagType.pm index 297be1510..702b4d4ec 100644 --- a/Bugzilla/API/1_0/Resource/FlagType.pm +++ b/Bugzilla/API/1_0/Resource/FlagType.pm @@ -11,7 +11,7 @@ use 5.10.1; use strict; use warnings; -use Bugzilla::API::1_0::Constants; +use Bugzilla::API::1_0::Constants qw(STATUS_CREATED); use Bugzilla::API::1_0::Util; use Bugzilla::Component; diff --git a/Bugzilla/API/1_0/Resource/Group.pm b/Bugzilla/API/1_0/Resource/Group.pm index aee8a7492..4efd7b476 100644 --- a/Bugzilla/API/1_0/Resource/Group.pm +++ b/Bugzilla/API/1_0/Resource/Group.pm @@ -11,7 +11,7 @@ use 5.10.1; use strict; use warnings; -use Bugzilla::API::1_0::Constants; +use Bugzilla::API::1_0::Constants qw(STATUS_CREATED); use Bugzilla::API::1_0::Util; use Bugzilla::Constants; diff --git a/Bugzilla/API/1_0/Resource/Product.pm b/Bugzilla/API/1_0/Resource/Product.pm index 0f393e207..dcd4b9a68 100644 --- a/Bugzilla/API/1_0/Resource/Product.pm +++ b/Bugzilla/API/1_0/Resource/Product.pm @@ -11,7 +11,7 @@ use 5.10.1; use strict; use warnings; -use Bugzilla::API::1_0::Constants; +use Bugzilla::API::1_0::Constants qw(STATUS_CREATED); use Bugzilla::API::1_0::Util; use Bugzilla::Product; diff --git a/Bugzilla/API/1_0/Resource/User.pm b/Bugzilla/API/1_0/Resource/User.pm index d2c869907..8b4e99e2e 100644 --- a/Bugzilla/API/1_0/Resource/User.pm +++ b/Bugzilla/API/1_0/Resource/User.pm @@ -11,7 +11,7 @@ use 5.10.1; use strict; use warnings; -use Bugzilla::API::1_0::Constants; +use Bugzilla::API::1_0::Constants qw(STATUS_CREATED); use Bugzilla::API::1_0::Util; use Bugzilla::Constants; diff --git a/Bugzilla/API/1_0/Server.pm b/Bugzilla/API/1_0/Server.pm index 108c25e27..83d09c401 100644 --- a/Bugzilla/API/1_0/Server.pm +++ b/Bugzilla/API/1_0/Server.pm @@ -11,7 +11,7 @@ use 5.10.1; use strict; use warnings; -use Bugzilla::API::1_0::Constants; +use Bugzilla::API::1_0::Constants qw(API_AUTH_HEADERS); use Bugzilla::API::1_0::Util qw(taint_data fix_credentials api_include_exclude); use Bugzilla::Constants; diff --git a/Bugzilla/API/1_0/Util.pm b/Bugzilla/API/1_0/Util.pm index 2d83e1d2d..d22935f6e 100644 --- a/Bugzilla/API/1_0/Util.pm +++ b/Bugzilla/API/1_0/Util.pm @@ -11,7 +11,7 @@ use 5.10.1; use strict; use warnings; -use Bugzilla::API::1_0::Constants; +use Bugzilla::API::1_0::Constants qw(API_AUTH_HEADERS); use Bugzilla::Error; use Bugzilla::Flag; use Bugzilla::FlagType; 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 { -- cgit v1.2.3-24-g4f1b