develooper Front page | perl.perl5.porters | Postings from October 2003

Re: [perl #24291] Taint checking against the wrong environment

Thread Previous | Thread Next
Rafael Garcia-Suarez
October 26, 2003 04:03
Re: [perl #24291] Taint checking against the wrong environment
Message ID: wrote:
> The main question I think is what C< *ENV = \%myenv > should mean:
> either it should act to replace the environment or not, and the
> rest of the core should act appropriately either way. I think in
> principle it would be most useful for it to replace the environment,
> but I accept that that involves a lot of extra code and could also
> make C< *ENV = \%myenv > unexpectedly slow. This implies that eg
> C< local %ENV = ( PATH => $path ) > should also work.

I recently documented in perlsub that C<local *foo> doesn't preserve
magic on $foo, @foo, %foo etc. (perlsub/"Localization of globs").
This feature can be useful when doing C<local *_> in order to
localize $_ _and_ drop all previous magic on $_ that might get in
the way. In other words, C<local %ENV> allows to modify the environment,
while C<local *ENV> does not.

Considering this, I think that a glob assignment to *ENV should drop
the env magic from it, and that the core must be fixed to deal with
it gracefully. That's more consistent with the rest of perl (and the
rest of magical variables.)

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