Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Re: Perl::TK - fileevent and script execution theory

by crabbdean (Pilgrim)
on Mar 25, 2004 at 00:27 UTC ( #339597=note: print w/replies, xml ) Need Help??

in reply to Re: Perl::TK - fileevent and script execution theory
in thread Perl::TK - fileevent and script execution theory

I've noticed in the above code that instead of exiting at the eof(CHILD) section it exists at the bottom "else" statement. All exiting commands I'm wanting to execute such as cleanup or "destroys" I'm putting here, which seems illogical. I would have thought it would exit at the "eof". Is there a reason for this?

Update: It would seem more correct to put the whole bottom "sysread" if statement as and "else" to the "eof". See below.
if (eof($handle)) { $widget->fileevent($handle, "readable", undef); # cancel bindi +ng return ; } else { if (sysread ($handle, $_, 128)) { $tx->insert('end', $_); # Append the data read $tx->yview('end'); } else { $tx->insert('end', times); $tx->yview('end'); $widget->fileevent($handle, "readable", undef); # cancel b +inding return; } }

The Funkster of Mirth
Programming these days takes more than a lone avenger with a compiler. - sam
RFC1149: A Standard for the Transmission of IP Datagrams on Avian Carriers

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://339597]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (13)
As of 2017-02-27 16:40 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (389 votes). Check out past polls.