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

my $code=sub{print "hi\n";}; &{$code};
the &{} part references the code section of its contents and calls it, much like if i have
my $var='hi'; my $ref=\$var; ${$ref}='there'; print "$var\n";
the ${}part references the scalar section of its contents allowing me to set it with the assign statement.

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

if ( $tkxfsr->{after}{$afterid}{sub}) { print 'sub:'.$tkxfsr->{after}{$afterid}{sub}."\n"; &{$tkxfsr->{after}{$afterid}{sub}}(); &{$tkxfsr->{after}{$afterid}{sub}}; }
on ubuntu it still fails as it did before but now it prints out the next two items in the queue after printing '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----------