in reply to Re: Tkx after coderef problem
in thread Tkx after coderef problem
Im not sure id call my use of ampersand an operator here. If i have the following
the &{} part references the code section of its contents and calls it, much like if i havemy $code=sub{print "hi\n";}; &{$code};
the ${}part references the scalar section of its contents allowing me to set it with the assign statement.my $var='hi'; my $ref=\$var; ${$ref}='there'; print "$var\n";
as for subs not existing, remember that for at least 1 and up to 5 times the call succeeded and the sub/coderef did exist, and at the end of MainLoop the sub/coderef still exists.
To show that the coderef still exists and is valid if i changed the "debug" statment at the end to
on ubuntu it still fails as it did before but now it prints out the next two items in the queue after printing 'sub:'.....if ( $tkxfsr->{after}{$afterid}{sub}) { print 'sub:'.$tkxfsr->{after}{$afterid}{sub}."\n"; &{$tkxfsr->{after}{$afterid}{sub}}(); &{$tkxfsr->{after}{$afterid}{sub}}; }
Edit:add output
encapulated sub=0 SCMD 1527954135_123_c1 hi LIST 1527954135_123_c1 hi 1---------- LIST 1527954135_123_c1 hi 2---------- LIST 1527954135_123_c1 hi 3---------- sub:CODE(0x9cdda24) LIST 1527954135_123_c1 hi 4---------- LIST 1527954135_123_c1 hi 5----------
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Tkx after coderef problem
by Anonymous Monk on Jun 02, 2018 at 16:54 UTC | |
by huck (Prior) on Jun 02, 2018 at 17:25 UTC | |
by Anonymous Monk on Jun 02, 2018 at 17:27 UTC | |
by huck (Prior) on Jun 02, 2018 at 17:36 UTC | |
by Anonymous Monk on Jun 02, 2018 at 20:50 UTC | |
|
In Section
Seekers of Perl Wisdom