in reply to Should one treat method name as input?
Refactor the main routine to handle both cases and give it a "utility" sounding name, then make the other two routines wrappers with a nicer interface into the big daddy.
sub big_daddy{ my ($self,$type,@args)=@_; ... } sub foo{ my $self=shift; $self->big_daddy('FOO',@_); } sub bar{ my $self=shift; $self->big_daddy('BAR',@_); }
If you really feel like being evil, you could make $type come from caller() so that the behaviour of bigdaddy is determined by what has called it, but IMO this is nasty stuff that isnt worth bothering with.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Should one treat method name as input?
by Eyck (Priest) on Jan 07, 2005 at 12:21 UTC |