Skip to content

Commit dd07b88

Browse files
committed
Make Exporter strict and warnings compliant
Update optree_specials since OptreeCheck.pm uses Exporter.
1 parent 761a583 commit dd07b88

File tree

5 files changed

+458
-315
lines changed

5 files changed

+458
-315
lines changed

dist/Exporter/lib/Exporter.pm

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
package Exporter;
22

3-
require 5.006;
4-
5-
# Be lean.
6-
#use strict;
7-
#no strict 'refs';
3+
use strict;
4+
no strict 'refs';
85

96
our $Debug = 0;
107
our $ExportLevel = 0;
118
our $Verbose ||= 0;
12-
our $VERSION = '5.75';
13-
our (%Cache);
9+
our $VERSION = '5.76';
10+
our %Cache;
1411

1512
sub as_heavy {
1613
require Exporter::Heavy;

dist/Exporter/lib/Exporter/Heavy.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use strict;
44
no strict 'refs';
55

66
# On one line so MakeMaker will see it.
7-
our $VERSION = '5.75';
7+
our $VERSION = '5.76';
88

99
=head1 NAME
1010

dist/Exporter/t/Exporter.t

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!perl -w
22

3+
use strict;
4+
use warnings;
5+
36
# Can't use Test::Simple/More, they depend on Exporter.
47
my $test;
58
sub ok ($;$) {
@@ -24,33 +27,30 @@ BEGIN {
2427
}
2528

2629

27-
BEGIN {
28-
# Methods which Exporter says it implements.
29-
@Exporter_Methods = qw(import
30+
our @Exporter_Methods = qw(import
3031
export_to_level
3132
require_version
3233
export_fail
3334
);
34-
}
3535

3636

3737
package Testing;
3838
require Exporter;
39-
@ISA = qw(Exporter);
39+
our @ISA = qw(Exporter);
4040

4141
# Make sure Testing can do everything its supposed to.
4242
foreach my $meth (@::Exporter_Methods) {
4343
::ok( Testing->can($meth), "subclass can $meth()" );
4444
}
4545

46-
%EXPORT_TAGS = (
46+
our %EXPORT_TAGS = (
4747
This => [qw(stuff %left)],
4848
That => [qw(Above the @wailing)],
4949
tray => [qw(Fasten $seatbelt)],
5050
);
51-
@EXPORT = qw(lifejacket is);
52-
@EXPORT_OK = qw(under &your $seat);
53-
$VERSION = '1.05';
51+
our @EXPORT = qw(lifejacket is);
52+
our @EXPORT_OK = qw(under &your $seat);
53+
our $VERSION = '1.05';
5454

5555
::ok( Testing->require_version(1.05), 'require_version()' );
5656
eval { Testing->require_version(1.11); 1 };
@@ -168,15 +168,15 @@ Testing->import('!/e/');
168168

169169

170170
package More::Testing;
171-
@ISA = qw(Exporter);
172-
$VERSION = 0;
171+
our @ISA = qw(Exporter);
172+
our $VERSION = 0;
173173
eval { More::Testing->require_version(0); 1 };
174174
::ok(!$@, 'require_version(0) and $VERSION = 0');
175175

176176

177177
package Yet::More::Testing;
178-
@ISA = qw(Exporter);
179-
$VERSION = 0;
178+
our @ISA = qw(Exporter);
179+
our $VERSION = 0;
180180
eval { Yet::More::Testing->require_version(10); 1 };
181181
::ok($@ !~ /\(undef\)/, 'require_version(10) and $VERSION = 0');
182182

@@ -185,8 +185,8 @@ my $warnings;
185185
BEGIN {
186186
local $SIG{__WARN__} = sub { $warnings = join '', @_ };
187187
package Testing::Unused::Vars;
188-
@ISA = qw(Exporter);
189-
@EXPORT = qw(this $TODO that);
188+
our @ISA = qw(Exporter);
189+
our @EXPORT = qw(this $TODO that);
190190

191191
package Foo;
192192
Testing::Unused::Vars->import;
@@ -196,8 +196,8 @@ BEGIN {
196196
print "# $warnings\n";
197197

198198
package Moving::Target;
199-
@ISA = qw(Exporter);
200-
@EXPORT_OK = qw (foo);
199+
our @ISA = qw(Exporter);
200+
our @EXPORT_OK = qw (foo);
201201

202202
sub foo {"This is foo"};
203203
sub bar {"This is bar"};
@@ -215,12 +215,11 @@ Moving::Target->import ('bar');
215215
::ok (bar() eq "This is bar", "imported bar after EXPORT_OK changed");
216216

217217
package The::Import;
218-
219218
use Exporter 'import';
220219

221220
::ok(\&import == \&Exporter::import, "imported the import routine");
222221

223-
@EXPORT = qw( wibble );
222+
our @EXPORT = qw( wibble );
224223
sub wibble {return "wobble"};
225224

226225
package Use::The::Import;
@@ -238,8 +237,8 @@ eval { Carp::croak() };
238237

239238
package Exporter::for::Tied::_;
240239

241-
@ISA = 'Exporter';
242-
@EXPORT = 'foo';
240+
our @ISA = 'Exporter';
241+
our @EXPORT = 'foo';
243242

244243
package Tied::_;
245244

dist/Exporter/t/warn.t

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ BEGIN {
2525

2626
package Foo;
2727
Exporter->import("import");
28-
@EXPORT_OK = "bar";
28+
our @EXPORT_OK = qw/bar/;
29+
2930

3031
package main;
3132

0 commit comments

Comments
 (0)