NAME

Alarm::_TieSIG - Module handling tying of %SIG for alarm extensions.

DESCRIPTION

This is an internal utility module for use with the Alarm::* alarm extensions, that handles tying of the Perl built-in variable %SIG. This is deep magic and you use this module at your own risk.

To use this class, simply use it and then call the Alarm::_TieSIG::tiesig() function. This replaces %SIG with a dummy tied hash.

Whenever the new %SIG is accessed, this class checks to see if the requested key is ALRM. If so, it calls sethandler() for STORE's, and gethandler() for FETCHes. You must provide both of these methods in your package.

All other operations are passed on to the original, magic %SIG.

Note: Do not call tiesig() more than once. Doing so produces a warning and no other effects.

EXAMPLE

The following code will disable, with warnings, attempts to set SIGALRM handlers in your program (although it's not impossible to get past if someone really wanted to):

use Alarm::_TieSIG;
Alarm::_TieSIG::tiesig();

sub sethandler {
  warn "\$SIG{ALRM} has been disabled.\n";
}

sub gethandler {
  warn "\$SIG{ALRM} has been disabled.\n";
}

DISCLAIMER

This module is not guaranteed to work. In fact, it will probably break at the most inconvient time. If this module breaks your program, destroys your computer, ruins your life, or otherwise makes you unhappy, do not complain (especially not to me). It's your own fault.

AUTHOR

Written by Cory Johns (c) 2001.