in reply to Tkx after coderef problem
I have also discovered that the following syntax also works.
sub accept_out_cclose_after { my $tkxfsr=shift; my $afterid=shift; my $delay=shift; my $send_id; if ($esub==1) { $send_id=Tkx::after( $delay , sub{&{$tkxfsr->{aft +er}{$afterid}{sub}}()});} elsif ($esub==2) { $send_id=Tkx::after( $delay , [$tkxfsr->{after}{$ +afterid}{sub}] );} else { $send_id=Tkx::after( $delay , $tkxfsr->{aft +er}{$afterid}{sub} ); } $tkxfsr->{after}{$afterid}{eventid}=$send_id; $tkxfsr->{after}{$afterid}{delay}=$delay; }
And i suspect that the [] notation in the Tkx::after call is doing the same thing i did with the sub {}, creating a one use anonymous subroutine reference.perl huh-after.pl -esub 2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tkx after coderef problem
by Anonymous Monk on Jun 02, 2018 at 20:42 UTC | |
by huck (Prior) on Jun 03, 2018 at 18:13 UTC | |
by huck (Prior) on Jun 02, 2018 at 22:04 UTC | |
by Anonymous Monk on Jun 03, 2018 at 09:59 UTC |