Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^6: Tkx after coderef problem

by huck (Prior)
on Jun 02, 2018 at 17:36 UTC ( [id://1215751]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Tkx after coderef problem
in thread Tkx after coderef problem

"Which edact callback. Eval...warn$@ "HUH?

Possibly the answer is the "callback generated by $send_id=Tkx::after( $delay ,       $tkxfsr->{after}{$afterid}{sub} );" but it is hard to tell what you are saying, maybe you need to think about what you are saying instead. And remember both methods work just fine on windows, just not on linux.

What are you trying to say by "Eval...warn$@"

Replies are listed 'Best First'.
Re^7: Tkx after coderef problem
by Anonymous Monk on Jun 02, 2018 at 20:50 UTC
    That code generates no subroutine. Eliminate the doubts. Identify the exact line that fails in the subroutine. If you need to wrap the entire sub in eval to get something more than the generic failed to callback . You have three calls to after.

      "That code generates no subroutine"

      That statement generates the actual callback, it is quite clear the subroutine to callback resides at $tkxfsr->{after}{$afterid}{sub} and that the anonymous subroutine was created by

      $tkxfsr->{after}{$afterid}{sub}=sub{ return unless ($tkxfsr->{after} && $tkxfsr->{after} +{$afterid} && $tkxfsr->{after}{$afterid}{q}); if (scalar(@{$tkxfsr->{after}{$afterid}{q}})) { accept_out_cclose_after($tkxfsr,$afterid,int(ra +nd(2000))); my $msg=shift @{$tkxfsr->{after}{$afterid}{q}}; + print 'LIST '.$msg."\n"; } else { print 'DONE '.$id.' 0'."\n"; delete $tkxfsr->{after}{$afterid}; } };
      As was noted in "debug modification" section at Re^2: Tkx after coderef problem the routine itself functions not as a mere callback but also in a standalone call, so that i why why you confused me whey you asked about the callback. Now in $send_id=Tkx::after( $delay , sub{&{$tkxfsr->{after}{$afterid}{sub}}()}); i might consider the sub{...} as the callback because it is an anonymous subroutine only created by the Tkx::after call and discarded when the after call is canceled or has signaled execution and disposed(destroyed?) its reference. But still the "callback" is the link back, not the subroutine code itself.

      "Eliminate the doubts."

      I have eliminated many of them so far, yet you have yet to offer anything of subsistence to the quest sofar.

      "Identify the exact line that fails in the subroutine."

      Nothing fails in the subroutine, what the problem is that sometimes tkx::after(Tcl/after actually) barfs all over the floor when trying to call the subroutine passed to Tkx::after as a "static" code reference, Not all the time mind you, just sometimes, and in a unpredictable pattern even.

      "If you need to wrap the entire sub in eval to get something more than the generic failed to callback ."

      Nothing is failing in the sub, wrapping it in an eval will do no good, termination of any active code series after calling Tkx::after. At that point the eval will return, and it will fallback nto the eventloop, the eval wont hangaround for when the delay of Tkx::after has expired and it tries to call the subroutine at its internal callback link. Whatever is going wrong is happening in TK/TCL land, as it seems to have lost the ability to callback a perl subroutine when that callback is to a existing scalar reference rather than to an anonymous one-use subroutine. Yet that same subroutine is still callable later at the same address by the perl routine.

      "You have three calls to after."

      yea, one of the 3 gets called based on the run time arg set by -esub. The one setting the callback to an existing scalar coderef fails, and says it doesnt think the callback reference points to subroutine anymore, even thought that after event was triggered by the exact same call to Tkx::after that has already worked from 1 to 5 times already.

      invalid command name "::perl::CODE(0x96f045c)"
      And only on ubuntu-linux, the same code works fine on windoze.

        Lol. Where is the tkx trace?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 02:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found