develooper Front page | perl.perl5.porters | Postings from January 2021

Re: local %SIG = (%SIG, $signame => ...) not working as expected?

Thread Previous | Thread Next
From:
Uri Guttman
Date:
January 12, 2021 20:53
Subject:
Re: local %SIG = (%SIG, $signame => ...) not working as expected?
Message ID:
c71fc443-ca7f-cb0e-0fe5-d55d80c4fcb4@stemsystems.com
On 1/12/21 3:40 PM, Corwin Brust wrote:
> Hi Eric!
>
> On Tue, Jan 12, 2021 at 1:32 PM Eric Wong <p5p@yhbt.net> wrote:
>> I've relied on a similar thing "local %ENV = (%ENV, k => $v)"
>> for ages, so is this anomaly for %SIG documented/expected?
> I wonder if you could be running into an entry in %ENV with a undef
> value?  In that case we could end up with an odd number of
> hash-elements and worse.  Perl will ignore the undef values from
> hashes "exploded" within parens, e.g. within the ... part of @x = (
> ... ).  When we come to assign the resulting list back into a new hash
> we then get "misalignments".

i wonder why he copies %ENV. he should be able to just do:

     local( $SIG{$signame} ) = blah ;

the is faster and doesn't have the odd number thing you mention

uri


Thread Previous | Thread Next


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