On 6/10/06, OROSZI Balázs <[EMAIL PROTECTED]> wrote:

How could I implement a system in Perl, in which portions of code
(plugins) are loaded dynamically from a given location, and then
executed?

You could use modules.

The task is quite simple, all I want the plugins to do is that they get
some data, work with it, and give back some data.

Modules can do that.

It is important, that main.pl will get the list of plugins dynamically,
so adding a new one should be a copy to the given directory and no
modification of main.pl

Modules work that way.

It would also be important, that if a plugin fails to load (syntax
errors, etc.) then the main program shouldn't crash, but go on,
discarding the plugin, and writing some error to screen.

This is not normally the way a module works. It's probably better to
debug your code before you install it, since loading is no guarantee
of correct operation. But, if you need this behavior, you could use an
eval block to trap those errors.

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to