in reply to code ref
$mw->Button(command => sub { $self->func1($a) })->pack();Instead of using a subroutine reference, this uses an anonymous subroutine which establishes the correct object and parameters. Note, however, that if $self changes, the subroutine is a closure and might not have the same value as you'd expect. Test carefully.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Declaring Code Reference With Parameters
by pg (Canon) on Nov 10, 2002 at 01:27 UTC | |
by FamousLongAgo (Friar) on Nov 10, 2002 at 01:34 UTC | |
by tadman (Prior) on Nov 10, 2002 at 01:30 UTC |