snafu has asked for the wisdom of the Perl Monks concerning the following question:
I did a search and found some ideas using Carp and eval()'s but felt that since this program is already 99.9% done being written, it's on a deadline, and it's working quite well that this would be an acceptable way of getting what I want.
TIA
72 ## Place this first. 73 for my $sig ( keys(%SIG) ) 74 { 75 $EXIT++; 76 outmsg(' Processing handler: '.$sig.'('.$EXIT.')',1); 77 78 $SIG{$sig} = sub 79 { 80 outmsg('Caught signal: '.$sig.'...dying +.',2,$EXIT); 81 }; 82 } 83 84 ## Then any specific handlers here...next. 85 $SIG{USR1} = sub 86 { 87 ## Make sure that the process is in a sleep state so that 88 ## we don't inadvertently interrupt a run cycle. 89 if ( $SLEEPING ) 90 { 91 outmsg(' CAUGHT USR1! -- pre-empti +ng sleep '. 92 'schedule.',10); 93 _main(); 94 } 95 }; 96
_
_
_
_
_
_
_
_
_
_
- Jim
Insert clever comment here...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Global SIG handler: Is this advisable? Is there a better way?
by samtregar (Abbot) on Aug 29, 2006 at 17:37 UTC | |
by snafu (Chaplain) on Aug 29, 2006 at 17:42 UTC | |
|
Re: Global SIG handler: Is this advisable? Is there a better way?
by cdarke (Prior) on Aug 29, 2006 at 19:05 UTC | |
by snafu (Chaplain) on Aug 29, 2006 at 20:52 UTC | |
|
Re: Global SIG handler: Is this advisable? Is there a better way?
by diotalevi (Canon) on Aug 29, 2006 at 21:09 UTC |