Commit d6c2d37b authored by David Lawrence's avatar David Lawrence

Bug 1153125: bug 1051056 causes "Constant subroutine redefined" warnings during t/001compile.t

r=LpSolit,a=glob
parent 7d0c10e7
...@@ -15,7 +15,7 @@ use Bugzilla::Hook; ...@@ -15,7 +15,7 @@ use Bugzilla::Hook;
use parent qw(Exporter); use parent qw(Exporter);
our @EXPORT = qw( our @EXPORT_OK = qw(
WS_ERROR_CODE WS_ERROR_CODE
STATUS_OK STATUS_OK
......
...@@ -11,7 +11,7 @@ use 5.10.1; ...@@ -11,7 +11,7 @@ use 5.10.1;
use strict; use strict;
use warnings; 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::API::1_0::Util;
use Bugzilla::Comment; use Bugzilla::Comment;
......
...@@ -11,7 +11,7 @@ use 5.10.1; ...@@ -11,7 +11,7 @@ use 5.10.1;
use strict; use strict;
use warnings; 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::API::1_0::Util;
use Bugzilla::Component; use Bugzilla::Component;
......
...@@ -11,7 +11,7 @@ use 5.10.1; ...@@ -11,7 +11,7 @@ use 5.10.1;
use strict; use strict;
use warnings; 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::API::1_0::Util;
use Bugzilla::Component; use Bugzilla::Component;
......
...@@ -11,7 +11,7 @@ use 5.10.1; ...@@ -11,7 +11,7 @@ use 5.10.1;
use strict; use strict;
use warnings; 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::API::1_0::Util;
use Bugzilla::Constants; use Bugzilla::Constants;
......
...@@ -11,7 +11,7 @@ use 5.10.1; ...@@ -11,7 +11,7 @@ use 5.10.1;
use strict; use strict;
use warnings; 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::API::1_0::Util;
use Bugzilla::Product; use Bugzilla::Product;
......
...@@ -11,7 +11,7 @@ use 5.10.1; ...@@ -11,7 +11,7 @@ use 5.10.1;
use strict; use strict;
use warnings; 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::API::1_0::Util;
use Bugzilla::Constants; use Bugzilla::Constants;
......
...@@ -11,7 +11,7 @@ use 5.10.1; ...@@ -11,7 +11,7 @@ use 5.10.1;
use strict; use strict;
use warnings; 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::API::1_0::Util qw(taint_data fix_credentials api_include_exclude);
use Bugzilla::Constants; use Bugzilla::Constants;
......
...@@ -11,7 +11,7 @@ use 5.10.1; ...@@ -11,7 +11,7 @@ use 5.10.1;
use strict; use strict;
use warnings; use warnings;
use Bugzilla::API::1_0::Constants; use Bugzilla::API::1_0::Constants qw(API_AUTH_HEADERS);
use Bugzilla::Error; use Bugzilla::Error;
use Bugzilla::Flag; use Bugzilla::Flag;
use Bugzilla::FlagType; use Bugzilla::FlagType;
......
...@@ -95,25 +95,26 @@ sub server { ...@@ -95,25 +95,26 @@ sub server {
sub constants { sub constants {
my ($self) = @_; my ($self) = @_;
my $api_version = $self->api_version; return $self->{_constants} if defined $self->{_constants};
no strict 'refs'; no strict 'refs';
my $api_version = $self->api_version;
my $class = "Bugzilla::API::${api_version}::Constants"; my $class = "Bugzilla::API::${api_version}::Constants";
require_module($class); require_module($class);
my %constants; $self->{_constants} = {};
foreach my $constant (@{$class . "::EXPORT"}, @{$class . "::EXPORT_OK"}) { foreach my $constant (@{$class . "::EXPORT_OK"}) {
if (ref $class->$constant) { if (ref $class->$constant) {
$constants{$constant} = $class->$constant; $self->{_constants}->{$constant} = $class->$constant;
} }
else { else {
my @list = ($class->$constant); 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 { sub response_header {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment