Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^3: Perl suddenly pauses for key input

by clueless newbie (Chaplain)
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.

Replies are listed 'Best First'.
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:

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2018-04-25 09:48 GMT
Find Nodes?
    Voting Booth?