Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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]
[zentara]: Strange, on clicking a link in a node, I am taken to that node, but my votes and login are lost. Should I post a Permonks Discussion?
[choroba]: that just means someone used a wrong link format
[choroba]: msg them or consider to fix
[zentara]: Gratias
[LanX]: pm != tk ;)
[Corion]: zentara: Most likely they used something like [http://www. node=123456] instead of [id://123456], which uses whatever domain you're visiting from

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2017-05-26 12:34 GMT
Find Nodes?
    Voting Booth?