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); }
In reply to Using eval for by SuperCruncher
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |