- or download this
module Exporter;
- or download this
use strict;
use warnings;
use warnings::register; #assuming this continues to exist...
- or download this
sub import($pkg : ARRAY $export=undef, ARRAY $ok=undef, HASH $tags=und
+ef) {
- or download this
ARRAY $export=undef
- or download this
ARRAY $export //= undef
- or download this
my $from_pkg=caller.package;
- or download this
my $from_pag = caller.MY.package;
- or download this
pkg_alias($from_pkg, "Exporter::From");
&Exporter::From::import := &myimport;
- or download this
sub pkg_alias($original, $new) {
#Any sufficiently encapsulated hack...
...
%{"${original}::"} := %{"${new}::"}; #XXX will this actually wo
+rk?
}
- or download this
sub myimport($exp_from : *@symbols=() : *@options=()) {
- or download this
my $exp_to=caller.package; #is this how caller is used?
...
#defaults
@symbols //= @Exporter::From::EXPORT;
- or download this
$foo ||= 'bar';
- or download this
$foo //= $bar // $baz // 'nothing to see here, folks';
- or download this
#expand tags to their values
@symbols=map {
...
@{%Exporter::From::EXPORT_TAGS}{$_}} ::
$_
} @symbols;
- or download this
for(@symbols) {
#handle version numbers
...
$exp_from.require_version($_);
next;
}
- or download this
#handle renamed exports
my($to, $from)=$_.ref eq 'PAIR' ? ($_.left, $_.right) : ($_, $
+_);
- or download this
for($to, $from) {
#make sure it has some sort of sigil
$_='&' _ $_ unless m'^[$@%&]';
}
- or download this
warnings::warnif("$from exported from $exp_from conflicts with
+ existing $to at $(caller.file) line $(caller.line).\n")
if defined %Exporter::To::{$to};
- or download this
%Exporter::To::{$to}=%Exporter::From::{$from};
}
- or download this
for(@options) {
my($sign, $name, $value)=/[+-]([[\w]&&[^\d]]\w+)(?:=(.*))?/s;
...
}
}
}
- or download this
if(defined $export) {
@Exporter::From::EXPORT=@$export;
...
%Exporter::From::EXPORT_TAGS=%$tags;
}
}
- or download this
if(defined $export) {
@Exporter::From::EXPORT = $export;
...
%Exporter::From::EXPORT_TAGS = $tags;
}
}