use strict; use Win32::API; # sub catch { my $signame = shift; die "bye...\n"; } # my $func = "\&catch"; # my $Con_Event = new Win32::API('kernel32', 'SetConsoleCtrlHandler', 'PI', 'N'); # if (!$Con_Event) { exit; } my $return = $Con_Event->Call($func, 1); if (!$return) { exit; } # loop for test only for (;;) { }