383
|
5547 |
1101 |
0 |
${$class . "::" . "EXPORTABLES";} ||= do {
my($pkg, $symbols, %done, @all, %any, %tags, %hooks, @fails, @before, @after);
my(@pending) = $class;
while ($pkg = shift @pending) {
next if $done{$pkg}++;
if ($symbols = ${$pkg . "::" . "EXPORT_ANY";}) {
$symbols = [split(/(?:,\s*)|\s+/, $symbols, 0)] unless ref $symbols eq "ARRAY";
$any{$_} ||= $pkg foreach (@$symbols);
};
if ($symbols = ${$pkg . "::" . "EXPORT_ALL";}) {
$symbols = [split(/(?:,\s*)|\s+/, $symbols, 0)] unless ref $symbols eq "ARRAY";
push @all, map({$any{$_} ||= $pkg;
$_;} @$symbols);
};
if ($symbols = ${$pkg . "::" . "EXPORT_TAGS";}) {
$tags{$_} ||= $symbols->{$_} foreach (keys %$symbols);
};
if ($symbols = ${$pkg . "::" . "EXPORT_HOOKS";}) {
($any{$_} or $hooks{$_} ||= $symbols->{$_}) foreach (keys %$symbols);
};
if ($symbols = ${$pkg . "::" . "EXPORT_FAIL";}) {
push @fails, $symbols;
};
if ($symbols = ${$pkg . "::" . "EXPORT_BEFORE";}) {
unshift @before, ref $symbols eq "CODE" ? $symbols : (ref $symbols eq "ARRAY" ? @$symbols : croak(sprintf("Invalid export %s handler specified: %s", "before", $symbols)));
};
if ($symbols = ${$pkg . "::" . "EXPORT_AFTER";}) {
unshift @after, ref $symbols eq "CODE" ? $symbols : (ref $symbols eq "ARRAY" ? @$symbols : croak(sprintf("Invalid export %s handler specified: %s", "after", $symbols)));
};
push @pending, @{$pkg . "::" . "ISA";};
};
[\@all, \%any, \%tags, \%hooks, \@fails, \@before, \@after]
} |