Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Handle Signal and Wrap Up

by dave_the_m (Monsignor)
on Aug 19, 2005 at 14:44 UTC ( [id://485163]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Handle Signal and Wrap Up
in thread Handle Signal and Wrap Up

What I mean is that if the program is in the middle of processing the 3rd element in the stack and it receives an interrupt signal, I'd like it to finish the 3rd element and ONLY the third element before it exits.
my $stop = 0; $SIG{whatever} = sub {$stop = 1 }; while(@stack and !$stop) { process(shift @stack); ... }

Dave.

Replies are listed 'Best First'.
Re^4: Handle Signal and Wrap Up
by aukjan (Friar) on Aug 19, 2005 at 18:11 UTC
    I would not put the 'stop' in the while statement, but put it at the end of the loop block, so to do an 'exit if $stop'...

    Go Fish!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-19 09:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found