diff options
Diffstat (limited to 'lib/Exporter.pm')
-rw-r--r-- | lib/Exporter.pm | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/Exporter.pm b/lib/Exporter.pm index 0b021b3d71..dce6909b18 100644 --- a/lib/Exporter.pm +++ b/lib/Exporter.pm @@ -2,9 +2,11 @@ package Exporter; require 5.000; -sub import { - my ($callpack, $callfile, $callline) = caller($ExportLevel); +$ExportLevel = 0; + +sub export { my $pack = shift; + my $callpack = shift; my @imports = @_; *exports = \@{"${pack}::EXPORT"}; if (@imports) { @@ -14,11 +16,14 @@ sub import { if (!%exports) { grep(s/^&//, @exports); @exports{@exports} = (1) x @exports; + foreach $extra (@{"${pack}::EXPORT_OK"}) { + $exports{$extra} = 1; + } } foreach $sym (@imports) { if (!$exports{$sym}) { if ($sym !~ s/^&// || !$exports{$sym}) { - warn "$sym is not exported by the $pack module ", + warn qq["$sym" is not exported by the $pack module ], "at $callfile line $callline\n"; $oops++; next; @@ -43,4 +48,10 @@ sub import { } }; +sub import { + local ($callpack, $callfile, $callline) = caller($ExportLevel); + my $pack = shift; + export $pack, $callpack, @_; +} + 1; |