in reply to Resuming from a SIG{INT}
Cheers - L~R#!/usr/bin/perl use strict; use warnings; $SIG{INT} = sub { print "Program interuption detected!\n"; print "Press ENTER to continue or any other key to quit\n"; my $foo = <STDIN>; chomp $foo; die "\nTerminating at users request\n" if $foo; print "Resuming our regularly scheduled programming\n"; }; print "This would be your program starting up\n"; for ( 1 .. 10 ) { print "$_\n" for 1 .. 10; sleep 1; } print "This would be your program finishing cleanly\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Resuming from a SIG{INT}
by kappa (Chaplain) on Mar 16, 2004 at 20:39 UTC | |
by Limbic~Region (Chancellor) on Mar 16, 2004 at 20:50 UTC |