I'm pretty new at this, and I'm trying to figure out how Perl's classes work with signals.
Specifically, it doesn't seem that a class's DESTROY function is called when you Ctrl-C the program.
I tried using
, but I'm not even sure this is the proper way to catch the signal. Either way, it seems I no longer receive a reference to my object when DESTROY is called. I keep getting this error:
Here is my DESTROY function:
[CODE=perl]
sub DESTROY {
my $self = shift;
my $runtime = time_passed();
print "Total run time: $runtime\n";
close(ERR);
close(WARN);
-d $self->{DIR}{THRESHOL D} ? print "All files saved to $self->{DIR}{THRESHOL D}.\n" : print "Self destroyed.\n";
die("done.\n\n" );
}
[/CODE]
Thanks for the help!
Specifically, it doesn't seem that a class's DESTROY function is called when you Ctrl-C the program.
I tried using
Code:
use sigtrap qw(handler DESTROY INT QUIT);
Code:
Can't locate object method "time_passed" via package "INT" (perhaps you forgot to load "INT"?) at /var/local/bush/lib/ASH/Basic.pm line 113.
[CODE=perl]
sub DESTROY {
my $self = shift;
my $runtime = time_passed();
print "Total run time: $runtime\n";
close(ERR);
close(WARN);
-d $self->{DIR}{THRESHOL D} ? print "All files saved to $self->{DIR}{THRESHOL D}.\n" : print "Self destroyed.\n";
die("done.\n\n" );
}
[/CODE]
Thanks for the help!
Comment