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

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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

In reply to Re^8: Tkx after coderef problem by huck
in thread Tkx after coderef problem by huck

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (1)
    As of 2020-10-25 05:44 GMT
    Find Nodes?
      Voting Booth?
      My favourite web site is:

      Results (249 votes). Check out past polls.