markusk has asked for the wisdom of the Perl Monks concerning the following question:
i.e This works SIG{INT} = \&gracefulExit; This doesn't work SIG{INT} = "$self->gracefulExit"; ################ package abc sub new { my $class = shift; my $self = {}; bless $self, $class; return $self; } sub initialize { my $self = shift; $SIG{INT} = "$self->gracefulExit"; } sub gracefulExit { my $self = shift; # Cleanup exit(); } 1 ################ # start of script use abc; $test = new abc(); $test->initialize(); # Control- C returns ... SIGINT handler "abc=HASH(0x229c34)->gracefulExit" not defined. I'm not sure why this is so, appreciate the help guys.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Signal calling to object method
by Anonymous Monk on Jun 11, 2009 at 00:33 UTC | |
|
Re: Signal calling to object method
by Anonymous Monk on Mar 07, 2017 at 16:20 UTC | |
by Anonymous Monk on Mar 07, 2017 at 16:22 UTC |