Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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]
[stevieb]: I've finally added the ability for berrybrew to fetch the list of perls available directly from Strawberry's releases.json file. Instead of pulling from there on every single call, I've added a berrybrew fetch, so it's only updated..
[stevieb]: ...on request. There's some supporting work I need to do, as well as update the docs, but it's in the v1.12 branch if anyone wants to play with it...
[stevieb]: ...issue 62 will track what else needs to be done.

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2017-03-31 01:32 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (364 votes). Check out past polls.