Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: win32, ctrl-c, sleep, and signals

by jesuashok (Curate)
on May 30, 2006 at 15:32 UTC ( [id://552524]=note: print w/replies, xml ) Need Help??


in reply to win32, ctrl-c, sleep, and signals

Hi

#!/usr/bin/perl use strict; use warnings; $SIG{INT} = 'handleit'; while (1) { print "still here...\n"; sleep 30; } sub handleit { print "I caught it."; exit(1); }
I tried the above code in windows it works for me.

"Keep pouring your ideas"

Replies are listed 'Best First'.
Re^2: win32, ctrl-c, sleep, and signals
by displeaser (Hermit) on May 30, 2006 at 15:36 UTC
    I've tried it on w2k and I get the same issue. If I control C before the first print it exits without the die message.
    Weird.
      Hi

      The reason could be die raises a signal. so Inside a signal handler, If a signal getting raised it will lead to misleading result. that is what happened in your code.

      Remove the die and use exit there. I have updated my node accordingly. use the same code and try in your important.

      That will work.

      "Keep pouring your ideas"
        That will work.

        Afraid not. :-) Still doesn't work for me. Peculiar.

        Thanks for trying it.

        Ken

        "This bounty hunter is my kind of scum: Fearless and inventive." --J.T. Hutt

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-16 03:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found