On Fri, Oct 22, 2021 at 04:19:29PM +0100, Paul "LeoNerd" Evans wrote: > On Fri, 22 Oct 2021 23:11:38 +0800 > Tom Molesworth via perl5-porters <perl5-porters@perl.org> wrote: > > Wouldn't the existing STDOUT local() support be more clear for this > > case? It also has the advantage of working equivalently for > > STDERR/warn: > > > > { > > local *STDOUT = $newh; > > print "Redirected"; > > } > > { > > local *STDERR = $newh; > > warn "Also redirected"; > > } > > > > Or is this aimed more at format-related functionality? > > Wow. I had actually forgotten you can do that. "Me too". (Actually, for me, it's more "I hadn't realised that this would work") > Turns out that's perfectly fine for my use-case, which was a small > unit-test around a print'ing method. I shall do that instead. I wondered - as it doesn't seem to be "obvious", should we document this? I'm proposing https://github.com/Perl/perl5/pull/19225 (and now we see whether the cygwin CI test fails on a docpatch) Nicholas ClarkThread Previous | Thread Next