Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^2: Tkx after coderef problem

by huck (Parson)
on Jun 02, 2018 at 15:08 UTC ( #1215740=note: print w/replies, xml ) Need Help??

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----------

Replies are listed 'Best First'.
Re^3: Tkx after coderef problem
by Anonymous Monk on Jun 02, 2018 at 16:54 UTC

    which sub is rAising invalid command? What command where? What is undefinex at time of sub call?

    The word is operator. If it's not an operator what is it a puppy?

      The word is operator. If it's not an operator what is it a puppy?

      It is not a puppy, it is a "dereferencing symbol"
      "Because of being able to omit the curlies for the simple case of $$x , people often make the mistake of viewing the dereferencing symbols as proper operators"

      "which sub is rAising invalid command?" It is the Tkx::after command that is raising invalid command when its time has arrived to actually call its argument.

      "What command where?"The command is the one created by $tkxfsr->{after}{$afterid}{sub}=sub{ ...}; since the code address match.

      "What is undefinex at time of sub call? " Nothing is actually undefined at the time of the call, but for some reason the execution part of Tkx:after thinks it is.

        Think about what youre saying. Which edact callback. Eval...warn$@

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1215740]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2020-09-19 09:35 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (114 votes). Check out past polls.