|go ahead... be a heretic|
Re: Dynamically Changing Packages w/out Evalby demerphq (Chancellor)
|on Jun 14, 2009 at 12:43 UTC||Need Help??|
Umm, what is it you think that the package statement does in this code?
Because I'm hard pressed to think of anything that it might affect in the code you have posted. The vars are all lexical. So they arent modified at all by the package declaration.
And actually your language is imprecise. Packages arent containers really. Not in the sense you state. Package statements are instead merely hints to the compiler as to how to deal with non-fully qualified identifiers. Subs dont run "in a package" they are compile time bound to specific lexical and global variables, which may be affected by the presence of a package statement, and indeed unqualfied sub declarations are installed in the stash relative to the current package, but other than that, well, packages dont exist. Not as a first order concept or object.
So what *exactly* is the problem you are trying to solve? This has all the hallmarks of an XY question.
update: after discussing on #p5p it was suggested that maybe you want to do this so as to not confuse Carp::carp or Carp::croak. If so then, well, those routines are arguably broken. Dont use them, possibly by changing them to cluck/confess and the problem goes away.