From: David Lawrence Date: Mon, 13 Apr 2015 13:59:31 +0000 (+0100) Subject: Bug 1153125: bug 1051056 causes "Constant subroutine redefined" warnings during t... X-Git-Tag: release-5.1.1~285 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6c2d37b69eb19b0f0136112d1da45dadb42cbb4;p=thirdparty%2Fbugzilla.git Bug 1153125: bug 1051056 causes "Constant subroutine redefined" warnings during t/001compile.t r=LpSolit,a=glob --- diff --git a/Bugzilla/API/1_0/Constants.pm b/Bugzilla/API/1_0/Constants.pm index caf670c7bc..44e20124ad 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 c61b2c6c29..8bdf9ae2da 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 c3bdc03867..96c2a3dcdc 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 297be1510c..702b4d4ec7 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 aee8a74925..4efd7b476b 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 0f393e2073..dcd4b9a684 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 d2c8699073..8b4e99e2ec 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 108c25e274..83d09c401f 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 2d83e1d2d2..d22935f6eb 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 439f6e7436..4969010378 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 {