From: Nicholas Clark Date: Fri, 9 Mar 2007 19:23:57 +0000 (+0000) Subject: Make Exporter::Heavy correctly not warn when exporting a symbol only X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=452617c3f7a5f3708b2a912420c39479d85cb7e5;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/lib/Exporter.t b/lib/Exporter.t index 2fbfcfa..1639cc1 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 27774c5..5784b76 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"} :