in reply to Re: Hiding, but maintaining variables in user-defined code
in thread Hiding, but maintaining variables in user-defined code
in other words, I want the call to "helper" in "execute()" to have arguements filled it for it without the user filling them in for himself, such that "helper" would be called with arguments ($self, $other_arg).
This boils down to: MyPackage has to remember the arguments.
Well, I would write a wrapper for that. Store the args in $self.
Hope this helps,sub execute{ $self = shift; $coderef = shift; if ( @_ ) { $self->args->{$coderef}=\@_ ; #or [$self, @_] }elsif ( ref(my $args = $self->args{$coderef}) eq 'ARRAY') { @_ = @$args; } return &$coderef( @_ ); }
Jeroen
"We are not alone"(FZ)
|
|---|