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

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

Thread Previous
From:
Eric Brine
Date:
July 1, 2020 08:53
Subject:
Re: What am I not grokking about $SIG{__WARN__}?
Message ID:
CALJW-qGkNebDqHWDa7FDs4XtcXgHARHBKVaCSvwakqP-bQ6Nhw@mail.gmail.com
Alternatively, instead of hooking the signal earlier (by adding a BEGIN
block), you can delay the delay the warning to runtime (by using C<< eval
EXPR >>).


On Tue., Jun. 30, 2020, 9:54 a.m. Sergey Aleynikov, <
sergey.aleynikov@gmail.com> wrote:

> вт, 30 июн. 2020 г. в 16:38, James E Keenan <jkeenan@pobox.com>:
> > BEGIN { local $SIG{__WARN__} = sub { $thiswarn = $_[0]; }; }
>
> LeoNerd answered about the 'local' behaviour here, but if you really
> need it - you can put a second BEGIN block at the end of the file,
> clearing/restoring __WARN__ handler.
>
> Best regards,
> Sergey Aleynikov
>

Thread Previous


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