Perl Debate Time ;-)
Arthur Corliss
corliss at sinbad.net
Sat Mar 20 19:32:19 CST 1999
On Sat, 20 Mar 1999, Michael Fowler wrote:
> Personally, I consider local invaluable. It makes the code I write, when
> doing certain things, far more readable. For example:
>
> # Without local
> my($backup_sig) = $SIG{__DIE__};
> $SIG{__DIE__} = 'IGNORE'; # ignore die requests
>
> # code you don't want killing the entire program if it dies
> # goes here
>
> $SIG{__DIE__} = $backup_sig;
>
> As opposed to:
>
> # With local
> {
> local($SIG{__DIE__}) = 'IGNORE';
> # code you don't want killing the entire program if it dies
> # goes here
> }
>
> To me, the latter is far cleaner, and easier to read. This is my primary
> use of local.
This is perhaps one of the best arguments I've seen for keeping local,
overloading signal handlers. Good call. :-)
--Arthur Corliss
Bolverk's Lair -- http://www.odinicfoundation.org/arthur/
"Live Free or Die, the Only Way to Live" -- NH State Motto
More information about the Anchorage-pm
mailing list