SuperCruncher has asked for the wisdom of the Perl Monks concerning the following question:
This sounds simple but the catch is that if a URL changes, the action to be taken will be completely different from URL to URL.
So I thought a relatively "clean" way of implementing this was to have a set of "plugin" files (Perl code) like foo.plugin, bar.plugin etc. These will specify a URL to check, and a 'do' function that will determine what is to be done if the URL has changed.
So, my questions:
foreach my $plugin (glob("*.plugin")) { do $plugin; }
foreach my $plugin (glob("*.plugin")) { do $plugin; if (!exists(&plugin::do_stuff) or !exists($url)) { die "Invalid plugin: function(s) not implemented.\n"; } # Call the various plugin 'methods' plugin::do_stuff(); undef (&plugin::do_stuff); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using eval for
by chip (Curate) on Dec 28, 2001 at 02:00 UTC | |
by SuperCruncher (Pilgrim) on Dec 28, 2001 at 04:13 UTC | |
by chip (Curate) on Dec 28, 2001 at 04:40 UTC | |
|
Re: Using eval for
by dmmiller2k (Chaplain) on Dec 28, 2001 at 02:15 UTC | |
|
Re: Using eval for
by rob_au (Abbot) on Dec 28, 2001 at 02:20 UTC | |
by SuperCruncher (Pilgrim) on Dec 28, 2001 at 04:25 UTC |