X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FImport-Into.git;a=blobdiff_plain;f=lib%2FImport%2FInto.pm;h=c14fd982384ff6f973436a2e6a8c36bd7fcdc7a1;hp=cc9ef0b6479a493b3697513c6edea7c7b992982d;hb=ba6a6452c916852159578e58761a827427a27a52;hpb=bd74adea007ab33d9b1321d911dd76371317c128 diff --git a/lib/Import/Into.pm b/lib/Import/Into.pm index cc9ef0b..c14fd98 100644 --- a/lib/Import/Into.pm +++ b/lib/Import/Into.pm @@ -4,7 +4,7 @@ use strict; use warnings FATAL => 'all'; use Module::Runtime; -our $VERSION = '1.002004'; +our $VERSION = '1.002005'; sub _prelude { my $target = shift; @@ -25,9 +25,13 @@ sub _prelude { sub _make_action { my ($action, $target) = @_; my $version = ref $target && $target->{version}; - my $ver_check = $version ? ', $version' : ''; eval _prelude($target) - . qq{sub { Module::Runtime::use_module( shift$ver_check )->$action(\@_) }} + . q[sub {] + . q[ my $module = shift;] + . q[ Module::Runtime::require_module($module);] + . (ref $target && exists $target->{version} ? q[ $module->VERSION($version);] : q[]) + . q[ $module->].$action.q[(@_);] + . q[}] or die "Failed to build action sub to ${action} for ${target}: $@"; }