in reply to import() into caller
The strict and warnings modules are special because they are pragmas. They get imported into whichever level is currently still being compiled.
Try something like this:
{ package Base; use File::Spec::Functions; sub import { File::Spec::Functions->import; } } { package A; use Base; # Now A doesn't have File::Spec::Functions!!! }
There's an Import::Into module which does allow you to pass an argument indicating where to import stuff into.
{ package Base; use File::Spec::Functions; use Import::Into; sub import { File::Spec::Functions->import::into( 1 ); # caller level 1 } } { package A; use Base; # Now A has File::Spec::Functions }
|
---|