in reply to Tied %SIG
Here is a working example of something that takes control of %SIG so you can insert other code if you like:
Someone else could even write their own version of this module and whoever's module loaded last would get first crack at changes and any changes from that module would be filtered by the previously loaded module, etc. - tye (but my friends call me "Tye")package Sigmund; use base qw( Tie::Hash ); my $realSig= \%::SIG; sub TIEHASH { return bless {}, shift; } sub STORE { my( $self, $key, $value )= @_; my $prev= $realSig->{$key}; # Replace this next line with whatever you like: warn "Changing $key signal handler.\n"; $realSig->{$key}= $value; return $prev; } sub FETCH { my( $self, $key )= @_; return $realSig->{$key}; } *::SIG= {}; tie %::SIG, __PACKAGE__; 1;
|
|---|