in reply to On the merits of implementing a script running application
In general it's a good idea to have some API and expose it to the outside world, but I don't see the benefit of having wrapper subs
The ScriptRunner contains lots of duplicate code that you should remove (at least if you stay with your current approach):
# instead of #sub value #{ # my ( $self ) = ScriptRunner->new(); # return $self->{'driver'}->value; #} sub make_wrapper { my $name = shift; return sub { ScriptRunner->new()->{'driver}->$name(@_); } } *value = make_wrapper('value'); *reset_counter = make_wrapper('reset_counter); ... # (untested)
You could also use autoloading (see perlsub, section "Autoloading") to achieve the same thing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: On the merits of implementing a script running application
by BaldManTom (Friar) on Apr 03, 2008 at 17:36 UTC |