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

Re^3: Perl suddenly pauses for key input

by clueless newbie (Hermit)
on Apr 17, 2009 at 20:38 UTC ( #758337=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Perl suddenly pauses for key input
in thread Perl suddenly pauses for key input

Perhaps you could add a sig handler to your code. Something like the sig handler here:

#! use Carp; use strict; use warnings; $SIG{INT}=\&CtrlC; sub CtrlC { $SIG{INT}=\&CtrlC; Carp::carp('Caught a CTRL/C'); }; sub mySub { for (1..10) { <STDIN>; }; }; for (1..10) { <STDIN>; }; mySub(); exit;
When it hangs again, just give it a ctrl/c and see where it carps from.


Comment on Re^3: Perl suddenly pauses for key input
Download Code
Re^4: Perl suddenly pauses for key input
by KHLeow (Novice) on Apr 18, 2009 at 03:55 UTC
    vroom: That was quite helpful. However, in Perl 5.8.8 in Windows environment, any attempt to override SIGINT or SIGBREAK will be ignored. Furthermore, my program communicates with another interface, which is old, and must be installed on Perl 5.8.8 to work. I can't upgrade my Perl version to 5.10.0.

    Anyway, the whole program is actually running within a huge Event-1.10 loop. I've setup a test environment with Perl 5.10.0 installed to experiment with your suggestion, and was letdown when Carp merely reports that CTRL/C was caught at this line:
    Event::loop;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2014-12-26 21:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (176 votes), past polls