|Think about Loose Coupling|
Mileage with safeby simon.proctor (Vicar)
|on Dec 11, 2001 at 16:16 UTC||Need Help??|
simon.proctor has asked for the wisdom of the Perl Monks concerning the following question:
I'm writing a content delivery system based on the Template Toolkit but with additional functionality added for configuration etc.
One feature that I am working on is to allow plugins to modify the program data as I move from one stage of the application to the next. This is in its early stages and I intend to make this as safe as possible by controlling program access as much as possible.
Currently, I am using 'require' and then 'import' to dynamically load my module and then run three predefined object methods. This is done within an eval block but I feel a little uncomfortable about that (as you can imagine :P). <bt>
Using 'safe' seems to be the answer to my problems as I can expose a single API object to the plugin compartment and control access (unless someone has a better idea?) but not having used it before I was wanting some advice.
Heres the current code where I'm using 'eval':