sub _importer {
my $target = shift;
- \($importers{$target} ||= eval qq{
- package $target;
- sub { my \$m = splice \@_, 1, 1; shift->\$m(\@_) };
- } or die "Couldn't build importer for $target: $@")
+ my ($package, $file, $line) = $target =~ /[^0-9]/ ? ($target) : caller($target + 1);
+ my $code = qq{package $package;\n}
+ . ($file ? "#line $line \"$file\"\n" : '')
+ . 'sub { my $m = splice @_, 1, 1; shift->$m(@_) };'."\n";
+ my $sub = \(eval $code
+ or die "Couldn't build importer for $package: $@");
+ $importers{$target} = $sub
+ unless $file;
+ $sub;
}
-
sub import::into {
my ($class, $target, @args) = @_;