Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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

Dean
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


Comment on Re: Re: Perl::TK - fileevent and script execution theory
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2014-12-26 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (169 votes), past polls