Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: capture output of a daemon in a tk widget on win32

by bl0rf (Pilgrim)
on Mar 24, 2004 at 03:06 UTC ( #339281=note: print w/ replies, xml ) Need Help??


in reply to capture output of a daemon in a tk widget on win32

Nice code xiper.
I tried making it work, but unfortunately the only thing I've discovered is that only the last handler/callback to be declared will be active. On my computer ( win2k, perl 5.8 ) the code only prints out the stderr messages, when reversed with stdout - it only gets the stdout messages.


Comment on Re: capture output of a daemon in a tk widget on win32
Re: Re: capture output of a daemon in a tk widget on win32
by xiper (Friar) on Mar 24, 2004 at 04:54 UTC
    Hmm, you appear to be right. I found this in Tk::fileevent:

    The readable and writable event handlers for a file are independent, and may be created and deleted separately. However, there may be at most one readable and one writable handler for a file at a given time in a given interpreter. If fileevent is called when the specified handler already exists in the invoking interpreter, the new callback replaces the old one.

    Not sure if "file" means filehandle tho'...

    Note also how the last callback gets fired 4 times, but only twice with data waiting... Different combinations of prints in the child result in generally inconsistent behaviour (that is, incidentally, consistent with blocking/buffering/deadlock type problems).

    My output:

    read_stderr() sysread() got 9 bytes: [stderr1 ] read_stderr() sysread() got 9 bytes: [stderr2 ] read_stderr() sysread() got 0 bytes: [] read_stderr() sysread() got 0 bytes: []

    - ><iper

    use japh; print;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (13)
As of 2014-12-26 18:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (174 votes), past polls