...
use Foo::Core::Specialized qw(Mixed func_a, func_b, :TAG_A);
...
####
### From Foo::Core::Specialized
use Foo::Core;
sub import {
my $this_pkg = shift;
my @imports = @_;
### Catch the word "Mixed" in the import list and react to it,
### removing it before continuting.
foreach (my $i = 0; $i < scalar(@imports); $i++) {
if ($imports[$i] eq 'Mixed') {
do_something();
splice(@imports, $i--, 1);
}
}
### The goal here is to switch to the calling package, do the
### import from the Foo::Core package into that calling package,
### then switch back to this package. The problem is, it
### doesn't work... there's no error, but the symbols aren't
### exported (anywhere I can find them =) either.
my $caller = caller();
eval "package $caller;";
Foo::Core->import(@imports);
eval "package $this_pkg;";
}
####
...
use Foo::Core qw(func_a, func_b, :DEFAULT);
use Foo::Core::Specialized 'Mixed';
...