in reply to Framing my scripts
If you're not afraid of objects, you can put the "wrapper" stuff in a base class which calls different_stuff(), which is always overridden by a subclass. You can then break up the wrapper stuff into various pieces, and the subclasses can override any other parts they like. Then an individual script would instantiate the subclass and invoke some main() or something.
Otherwise, you might take the wrapper stuff and stick it in a module that your individual scripts use. They can pass in a code ref to their own functionality. It might look like this:
use My::Wrapper qw(wrap); sub hello_world { my %params = %{shift()}; my $q = $params{q}; # etc. # different stuff here } wrap( \&hello_world );
Inside wrap...
sub wrap { my ( $code_ref ) = @_; # blah blah $code_ref->({ q => $q, T => \%T, # etc. }); # blah blah }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Framing my scripts
by Spidy (Chaplain) on Jul 27, 2007 at 02:41 UTC | |
by kyle (Abbot) on Jul 27, 2007 at 03:07 UTC | |
by pKai (Priest) on Jul 27, 2007 at 11:45 UTC |