Great! Thanks for the response. However, does this work on all platforms? Seems to me like this should be made to work with the $SIG(INT) line so that it works the same across all platforms. Is this reasonable or am I doing it wrong in the win32 and unix environments? Dan > -----Original Message----- > From: Joseph A. DiVerdi [mailto:diverdi@XTRsystems.com] > Sent: Thursday, November 16, 2000 8:37 PM > To: Daniel Wolstenholme; macperl@macperl.org > Subject: Re: [MacPerl] Script stop capture? > > > At 2:29 PM -0700 11/16/2000, Daniel Wolstenholme wrote: > >Is there any way to call a subroutine when the user stops a > perl script > >execution? For instance, on win32/unix machines, I add the following > >line: > >$SIG{INT} = \&ctrlc; > >Whenever the user presses Ctrl-C, the subroutine "ctrlc" is executed > >instead. Is there a way to do something similar on the mac? > > The subroutine named "END" will be executed when a MacPerl program is > stopped using "cmd-.". Take a look at the following program snippet: > > #! perl -w > > print "starting up...\n"; > while (1) { } > exit; > > sub END { print "entered END!\n" } > > Best regards, > Joseph > -- > Joseph A. DiVerdi, Ph.D., M.B.A. > http://www.XTRsystems.com 970.221.3982 (voice) > %PGPKeyID=('D50A9E33') 970.224.3723 (fax) > > # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org