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

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

Thread Previous | Thread Next
Eric Wong
January 12, 2021 21:11
Re: local %SIG = (%SIG, $signame => ...) not working as expected?
Message ID:
Uri Guttman <> wrote:
> 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

Laziness :)  I'm getting a hash(ref) of SIG overrides either as
a return value from another sub.  My workaround is something
like this:

	my %sig = $self->some_callback;
	local $SIG{$_} = $sig->{$_} for keys %sig;

My original (broken) code was this:

	local %SIG = (%SIG, $self->some_callback);

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