cat foo.pl #!/usr/bin/perl use strict; use warnings; sub DESTROY { print "Called main::DESTROY()\n"; } END { print "END called\n" } # $SIG{INT} = sub { print "SIGINT received\n"; exit }; my $x = bless []; 1 while 1; $ perl foo.pl ^C $ perl -i.orig -pe 's/^#// if $. > 2' foo.pl perl foo.pl ^CSIGINT received Called main::DESTROY() END called
You can see that on linux neither END block nor DESTROY sub are called, unless SIGINT is caught and a regular exit is done instead.
In reply to Re: Windows: Destructor not executed on Control-C
by moritz
in thread Windows: Destructor not executed on Control-C
by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |