From 9984a1ac3b522a563b8567d9ce361753018199fe Mon Sep 17 00:00:00 2001 From: Chad Granum <exodist7@gmail.com> Date: Thu, 17 Dec 2015 14:53:13 -0800 Subject: [PATCH] fix --- lib/Exporter/Heavy.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Exporter/Heavy.pm b/lib/Exporter/Heavy.pm index 21b67c1..98d3743 100755 --- a/lib/Exporter/Heavy.pm +++ b/lib/Exporter/Heavy.pm @@ -145,7 +145,7 @@ sub heavy_export { $cache_is_current = 1; } - if (!$export_cache->{$sym}) { + if (!$export_cache->{$sym} && ref($sym) ne 'HASH') { # accumulate the non-exports push @carp, qq["$sym" is not exported by the $pkg module\n]; @@ -194,13 +194,15 @@ sub heavy_export { warn "Importing into $callpkg from $pkg: ", join(", ",sort @imports) if $Exporter::Verbose; - foreach $sym (@imports) { + while (my $sym = shift @imports) { + my $spec = (@imports && ref($imports[0]) eq 'HASH') ? shift @imports : undef; + my $name = ($spec && $spec->{'-as'}) ? $spec->{'-as'} : $sym; # shortcut for the common case of no type character - (*{"${callpkg}::$sym"} = \&{"${pkg}::$sym"}, next) + (*{"${callpkg}::$name"} = \&{"${pkg}::$sym"}, next) unless $sym =~ s/^(\W)//; $type = $1; no warnings 'once'; - *{"${callpkg}::$sym"} = + *{"${callpkg}::$name"} = $type eq '&' ? \&{"${pkg}::$sym"} : $type eq '$' ? \${"${pkg}::$sym"} : $type eq '@' ? \@{"${pkg}::$sym"} : -- 1.9.1Thread Previous | Thread Next