Think about Loose Coupling | |
PerlMonks |
Re^2: Dynamically Changing Packages w/out Evalby betterworld (Curate) |
on Aug 25, 2009 at 12:11 UTC ( [id://791059]=note: print w/replies, xml ) | Need Help?? |
eval "package $package; &$code; 1" or die $@; I think you're missing a "\" before "$code". But then the code will be called via a code reference, and the contents of the code reference are still in the old package (where they were compiled):
The text of the warning will be "main" (not "foooo").
In Section
Seekers of Perl Wisdom
|
|