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

perlvar __WARN__ documentation

Peter Scott
November 10, 1999 11:03
perlvar __WARN__ documentation
Message ID:
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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About