develooper Front page | perl.perl5.porters | Postings from November 1999

perlvar __WARN__ documentation

From:
Peter Scott
Date:
November 10, 1999 11:03
Subject:
perlvar __WARN__ documentation
Message ID:
4.2.0.58.19991110105451.0099be80@mail.psdt.com
Quoth the 5.005_03 perlvar:

	You can use this to save warnings
	in a variable, or turn warnings into fatal errors, like this:

	    local $SIG{__WARN__} = sub { die $_[0] };
	    eval $proggie;

I don't understand why the string eval is there.  Yes, it works, but so 
would having the rest of the program, wouldn't it?  If the point is to show 
that the 'signal' can be caught would it not be better to put the local 
assignment, and the code being treated, inside a block eval?  (There again, 
why would the handler die if the programmer wanted to trap warnings?) 
$proggie doesn't appear anywhere else in the documentation.


--
Peter Scott
Pacific Systems Design Technologies




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About