Heavy.pm revision 7c478bd95313f5f23a4c958a745db2134aa03244
package Exporter;
=head1 NAME
Exporter::Heavy - Exporter guts
=head1 SYNOPIS
(internal use only)
=head1 DESCRIPTION
No user-serviceable parts inside.
=cut
#
# We go to a lot of trouble not to 'require Carp' at file scope,
# because Carp requires Exporter, and something has to give.
#
sub heavy_export {
# First make import warnings look like they're coming from the "use".
my $text = shift;
require Carp;
}
else {
warn $text;
}
};
require Carp;
Carp::croak("$_[0]Illegal null symbol in \@${1}::EXPORT")
};
*exports = *{"${pkg}::EXPORT"};
if (@imports) {
if (!%exports) {
grep(s/^&//, @exports);
my $ok = \@{"${pkg}::EXPORT_OK"};
if (@$ok) {
grep(s/^&//, @$ok);
}
}
my $tagsref = \%{"${pkg}::EXPORT_TAGS"};
my $tagdata;
my %imports;
# negated first item implies starting with default set:
if ($spec =~ s/^://){
if ($spec eq 'DEFAULT'){
}
}
else {
++$oops;
next;
}
}
elsif ($spec =~ m:^/(.*)/$:){
my $patn = $1;
}
else {
}
if $Verbose;
if ($remove) {
}
else {
}
}
}
if ($sym =~ m/^\d/) {
# If the version number was the only thing specified
# then we should act as if nothing was specified:
if (@imports == 1) {
last;
}
# We need a way to emulate 'use Foo ()' but still
# allow an easy version check: "use Foo 1.23, ''";
@imports = ();
last;
}
require Carp;
$oops++;
}
}
}
if ($oops) {
require Carp;
Carp::croak("Can't continue after import errors");
}
}
else {
}
*fail = *{"${pkg}::EXPORT_FAIL"};
if (@fail) {
if (!%fail) {
# Build cache of symbols. Optimise the lookup by adding
# barewords twice... both with and without a leading &.
# (Technique could be applied to %exports cache at cost of memory)
warn "${pkg}::EXPORT_FAIL cached: @expanded" if $Verbose;
}
my @failed;
if (@failed) {
require Carp;
"on this architecture");
}
if (@failed) {
require Carp;
Carp::croak("Can't continue after import errors");
}
}
}
warn "Importing into $callpkg from $pkg: ",
# shortcut for the common case of no type character
(*{"${callpkg}::$sym"} = \&{"${pkg}::$sym"}, next)
unless $sym =~ s/^(\W)//;
$type = $1;
*{"${callpkg}::$sym"} =
}
}
{
my $pkg = shift;
my $level = shift;
(undef) = shift; # XXX redundant arg
}
# Utility functions
sub _push_tags {
my $nontag;
*export_tags = \%{"${pkg}::EXPORT_TAGS"};
push(@{"${pkg}::$var"},
if ($nontag and $^W) {
# This may change to a die one day
require Carp;
Carp::carp("Some names are not tags");
}
}
# Default methods
sub export_fail {
my $self = shift;
@_;
}
sub require_version {
my $version = ${"${pkg}::VERSION"};
$version ||= "(undef)";
# %INC contains slashes, but $pkg contains double-colons.
$file &&= " ($file)";
require Carp;
Carp::croak("$pkg $wanted required--this is only version $version$file")
}
$version;
}
1;