diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-03-09 19:23:57 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-03-09 19:23:57 +0000 |
commit | 452617c3f7a5f3708b2a912420c39479d85cb7e5 (patch) | |
tree | a0ea5fa90bf2f78eddb06898f7ef5dc80a8beeb9 /lib | |
parent | 15fcae636016588132c47748c4e10dd810b45835 (diff) | |
download | perl-452617c3f7a5f3708b2a912420c39479d85cb7e5.tar.gz |
Make Exporter::Heavy correctly not warn when exporting a symbol only
declared in the export specification. Ensure that the test actually
tests this.
p4raw-id: //depot/perl@30529
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Exporter.t | 11 | ||||
-rw-r--r-- | lib/Exporter/Heavy.pm | 1 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/Exporter.t b/lib/Exporter.t index 2fbfcfa43b..1639cc11f3 100644 --- a/lib/Exporter.t +++ b/lib/Exporter.t @@ -8,7 +8,7 @@ BEGIN { } # Can't use Test::Simple/More, they depend on Exporter. -my $test = 1; +my $test; sub ok ($;$) { my($ok, $name) = @_; @@ -23,9 +23,12 @@ sub ok ($;$) { } -print "1..28\n"; -require Exporter; -ok( 1, 'Exporter compiled' ); +BEGIN { + $test = 1; + print "1..28\n"; + require Exporter; + ok( 1, 'Exporter compiled' ); +} BEGIN { diff --git a/lib/Exporter/Heavy.pm b/lib/Exporter/Heavy.pm index 27774c5a9a..5784b763ca 100644 --- a/lib/Exporter/Heavy.pm +++ b/lib/Exporter/Heavy.pm @@ -196,6 +196,7 @@ sub heavy_export { (*{"${callpkg}::$sym"} = \&{"${pkg}::$sym"}, next) unless $sym =~ s/^(\W)//; $type = $1; + no warnings 'once'; *{"${callpkg}::$sym"} = $type eq '&' ? \&{"${pkg}::$sym"} : $type eq '$' ? \${"${pkg}::$sym"} : |