package y; use Exporter qw (import ); our @EXPORT = qw ( &foo ); # exported functions my $callpack = ( caller )[0]; eval <<"EOH"; package $callpack; use Data::Dumper; use B::Deparse; # other modules... EOH sub foo { ... } 1;