eval "package $caller;";
Foo::Core->import(@imports);
####
eval "package $caller; Foo::Core->import(\@imports)";
####
package Foo::Core;
use Exporter qw(import);
our @EXPORT_OK = qw(func_a);
sub func_a {
print "in func_a(): @_\n";
}
1;
-----
package Foo::Core::Specialized;
use Foo::Core;
sub import {
my $this_pkg = shift;
my @imports = @_;
foreach (my $i = 0; $i < scalar(@imports); $i++) {
if ($imports[$i] eq 'Mixed') {
print "doing something with 'Mixed'...\n";
splice(@imports, $i--, 1);
}
}
my $caller = caller();
eval "package $caller; Foo::Core->import(\@imports)";
}
1;
-----
#!/usr/bin/perl
use Foo::Core::Specialized qw(Mixed func_a);
func_a(42, 'foo');
__END__
$ ./807805.pl
doing something with 'Mixed'...
in func_a(): 42 foo