On Fri, Mar 15, 2019 at 10:06:29AM +0000, Dagfinn Ilmari Mannsåker wrote:
> Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
>
> > On 2019-03-15 05:00, Noah Misch wrote:
> >> I consider the following style more idiomatic:
> >>
> >> {
> >> local %ENV;
> >> delete $ENV{PGAPPNAME};
> >> ...
> >> }
> >
> > That doesn't work because the first line clears the entire environment.
>
> The solution to that is to do 'local %ENV = %ENV;', to assign a copy of
> the original to the localised variable.
That's the right thing, not what I wrote. We use that in
src/bin/initdb/t/001_initdb.pl.