dash2 has asked for the wisdom of the Perl Monks concerning the following question:
One requirement is security: I think this is satisified by making sure the directory can only be written to by the owner of the script, so if he/she puts stupid stuff in there, that's his or her fault. Another requirement, pulling the other way, is future-proofing: it should be able to handle upgrades and plugins I haven't thought of yet. A final requirement is ease of use: no renaming stuff, no command line fiddling, just download and go.
My initial thought is as follows:
$can_be_called_from = { foo => 1, bar => 0, baz => 1 }; sub foo { ... } sub baz { ... } 1;
foreach ($plugin_script) { require $_; if ($plugin::can_be_called_from->{$where_I_was_called_from}) { #call the relevant subroutine } }
I have some worries about this.
(1) Is it really secure?
(2) I don't seem to be using the Perl module system very effectively, except to distinguish between different plugins' $can_be_called_from hashes.
Can anyone suggest an improvement, or some useful thoughts about this architecture problem? Either Perl-specific comments, or general ideas, are welcome.
Cheers,
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: architecture for module API
by Tyke (Pilgrim) on Feb 21, 2001 at 17:16 UTC | |
|
Re: architecture for module API
by AgentM (Curate) on Feb 22, 2001 at 02:28 UTC | |
by dash2 (Hermit) on Feb 22, 2001 at 15:04 UTC |