summaryrefslogtreecommitdiff
path: root/lib/Exporter.pm
diff options
context:
space:
mode:
authorLarry Wall <lwall@netlabs.com>1994-10-17 23:00:00 +0000
committerLarry Wall <lwall@netlabs.com>1994-10-17 23:00:00 +0000
commita0d0e21ea6ea90a22318550944fe6cb09ae10cda (patch)
treefaca1018149b736b1142f487e44d1ff2de5cc1fa /lib/Exporter.pm
parent85e6fe838fb25b257a1b363debf8691c0992ef71 (diff)
downloadperl-a0d0e21ea6ea90a22318550944fe6cb09ae10cda.tar.gz
perl 5.000perl-5.000
[editor's note: this commit combines approximate 4 months of furious releases of Andy Dougherty and Larry Wall - see pod/perlhist.pod for details. Andy notes that; Alas neither my "Irwin AccuTrack" nor my DC 600A quarter-inch cartridge backup tapes from that era seem to be readable anymore. I guess 13 years exceeds the shelf life for that backup technology :-(. ]
Diffstat (limited to 'lib/Exporter.pm')
-rw-r--r--lib/Exporter.pm17
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;