![]() |
|
laziness, impatience, and hubris | |
PerlMonks |
Re: Safe / @ISA Problemby simon.proctor (Vicar) |
on Mar 16, 2002 at 00:22 UTC ( #152113=note: print w/replies, xml ) | Need Help?? |
I'm no expert on Safe but I believe this to be a namespace problem. I played with your code and produced:
Which prints the 'hi there' message. I don't think this is what you want, however. If you are wanting to load code and run it (from packages) then I would keep the package code in separate files and do the loading, run-time evaluation in the Safe compartment. Now a disclaimer, this is how I do it but I don't know if there are any issues with it. I'd appreciate feedback :). If there is something wrong with this method then I've got some work to do on some of my projects :). My way is slightly more complex cos I use a factory object to load the modules. Here is a stripped down version with that factory code removed. I put your module code in a file, called A.pm. I also added a method: I know theres some useless variables (mainmodule etc) but they were all getting set via object methods and config file values so I left them in place. All the best and I hope this helps.
In Section
Seekers of Perl Wisdom
|
|