diff options
author | Todd Rinaldo <toddr@cpan.org> | 2020-10-02 14:12:23 -0500 |
---|---|---|
committer | Todd Rinaldo <toddr@cpan.org> | 2020-10-05 10:30:17 -0500 |
commit | dd07b88184b9bd3f6b53dc56af502937e127ee99 (patch) | |
tree | f97402d7252b3d358b6615047702e3620c73db7b /dist/Exporter | |
parent | 761a583dcfe0a08cdb7522dd462017a748febdbc (diff) | |
download | perl-dd07b88184b9bd3f6b53dc56af502937e127ee99.tar.gz |
Make Exporter strict and warnings compliant
Update optree_specials since OptreeCheck.pm uses Exporter.
Diffstat (limited to 'dist/Exporter')
-rw-r--r-- | dist/Exporter/lib/Exporter.pm | 11 | ||||
-rw-r--r-- | dist/Exporter/lib/Exporter/Heavy.pm | 2 | ||||
-rw-r--r-- | dist/Exporter/t/Exporter.t | 41 | ||||
-rw-r--r-- | dist/Exporter/t/warn.t | 3 |
4 files changed, 27 insertions, 30 deletions
diff --git a/dist/Exporter/lib/Exporter.pm b/dist/Exporter/lib/Exporter.pm index aee00c5951..28a6873d9f 100644 --- a/dist/Exporter/lib/Exporter.pm +++ b/dist/Exporter/lib/Exporter.pm @@ -1,16 +1,13 @@ package Exporter; -require 5.006; - -# Be lean. -#use strict; -#no strict 'refs'; +use strict; +no strict 'refs'; our $Debug = 0; our $ExportLevel = 0; our $Verbose ||= 0; -our $VERSION = '5.75'; -our (%Cache); +our $VERSION = '5.76'; +our %Cache; sub as_heavy { require Exporter::Heavy; diff --git a/dist/Exporter/lib/Exporter/Heavy.pm b/dist/Exporter/lib/Exporter/Heavy.pm index d7daf6e80c..404b4c122b 100644 --- a/dist/Exporter/lib/Exporter/Heavy.pm +++ b/dist/Exporter/lib/Exporter/Heavy.pm @@ -4,7 +4,7 @@ use strict; no strict 'refs'; # On one line so MakeMaker will see it. -our $VERSION = '5.75'; +our $VERSION = '5.76'; =head1 NAME diff --git a/dist/Exporter/t/Exporter.t b/dist/Exporter/t/Exporter.t index 4215d7e3fc..2fcd00384f 100644 --- a/dist/Exporter/t/Exporter.t +++ b/dist/Exporter/t/Exporter.t @@ -1,5 +1,8 @@ #!perl -w +use strict; +use warnings; + # Can't use Test::Simple/More, they depend on Exporter. my $test; sub ok ($;$) { @@ -24,33 +27,30 @@ BEGIN { } -BEGIN { - # Methods which Exporter says it implements. - @Exporter_Methods = qw(import +our @Exporter_Methods = qw(import export_to_level require_version export_fail ); -} package Testing; require Exporter; -@ISA = qw(Exporter); +our @ISA = qw(Exporter); # Make sure Testing can do everything its supposed to. foreach my $meth (@::Exporter_Methods) { ::ok( Testing->can($meth), "subclass can $meth()" ); } -%EXPORT_TAGS = ( +our %EXPORT_TAGS = ( This => [qw(stuff %left)], That => [qw(Above the @wailing)], tray => [qw(Fasten $seatbelt)], ); -@EXPORT = qw(lifejacket is); -@EXPORT_OK = qw(under &your $seat); -$VERSION = '1.05'; +our @EXPORT = qw(lifejacket is); +our @EXPORT_OK = qw(under &your $seat); +our $VERSION = '1.05'; ::ok( Testing->require_version(1.05), 'require_version()' ); eval { Testing->require_version(1.11); 1 }; @@ -168,15 +168,15 @@ Testing->import('!/e/'); package More::Testing; -@ISA = qw(Exporter); -$VERSION = 0; +our @ISA = qw(Exporter); +our $VERSION = 0; eval { More::Testing->require_version(0); 1 }; ::ok(!$@, 'require_version(0) and $VERSION = 0'); package Yet::More::Testing; -@ISA = qw(Exporter); -$VERSION = 0; +our @ISA = qw(Exporter); +our $VERSION = 0; eval { Yet::More::Testing->require_version(10); 1 }; ::ok($@ !~ /\(undef\)/, 'require_version(10) and $VERSION = 0'); @@ -185,8 +185,8 @@ my $warnings; BEGIN { local $SIG{__WARN__} = sub { $warnings = join '', @_ }; package Testing::Unused::Vars; - @ISA = qw(Exporter); - @EXPORT = qw(this $TODO that); + our @ISA = qw(Exporter); + our @EXPORT = qw(this $TODO that); package Foo; Testing::Unused::Vars->import; @@ -196,8 +196,8 @@ BEGIN { print "# $warnings\n"; package Moving::Target; -@ISA = qw(Exporter); -@EXPORT_OK = qw (foo); +our @ISA = qw(Exporter); +our @EXPORT_OK = qw (foo); sub foo {"This is foo"}; sub bar {"This is bar"}; @@ -215,12 +215,11 @@ Moving::Target->import ('bar'); ::ok (bar() eq "This is bar", "imported bar after EXPORT_OK changed"); package The::Import; - use Exporter 'import'; ::ok(\&import == \&Exporter::import, "imported the import routine"); -@EXPORT = qw( wibble ); +our @EXPORT = qw( wibble ); sub wibble {return "wobble"}; package Use::The::Import; @@ -238,8 +237,8 @@ eval { Carp::croak() }; package Exporter::for::Tied::_; -@ISA = 'Exporter'; -@EXPORT = 'foo'; +our @ISA = 'Exporter'; +our @EXPORT = 'foo'; package Tied::_; diff --git a/dist/Exporter/t/warn.t b/dist/Exporter/t/warn.t index 30109644b9..2186674543 100644 --- a/dist/Exporter/t/warn.t +++ b/dist/Exporter/t/warn.t @@ -25,7 +25,8 @@ BEGIN { package Foo; Exporter->import("import"); -@EXPORT_OK = "bar"; +our @EXPORT_OK = qw/bar/; + package main; |