my $caller_pack = caller; # --- modulino # run test script if Module not required unless (caller) { use English; my $run =`$EXECUTABLE_NAME t_lexical_unimport.pl`; exit; } use strict; use warnings; package Module; use Carp; sub import { warn "* importing from ",__PACKAGE__,"\n"; no strict 'refs'; *{"${caller_pack}::func"} = \&func; } sub unimport { warn "* unimporting from ",__PACKAGE__,"\n"; no strict 'refs'; delete ${"${caller_pack}::"}{func}; # dirty: deletes whole glob } # ---------- to be exported sub func { carp "running func(@_)"; } 1;