develooper Front page | perl.perl5.porters | Postings from June 2020

Re: What am I not grokking about $SIG{__WARN__}?

Thread Previous | Thread Next
Paul "LeoNerd" Evans
June 30, 2020 13:44
Re: What am I not grokking about $SIG{__WARN__}?
Message ID:
On Tue, 30 Jun 2020 09:38:16 -0400
James E Keenan <> wrote:

> BEGIN { local $SIG{__WARN__} = sub { $thiswarn = $_[0]; }; }

The local scope ends as soon as the BEGIN block ends. Thus that didn't
ever catch anything.

It's really nontrivial to `local`y capture warnings at compiletime. You
can't use `local` inside a BEGIN block, because of this.

Paul "LeoNerd" Evans      |  |

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About