[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

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