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!