Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 4d4eaa2cb3eb05793dc301178e47fe89488a88f0
      
https://github.com/Perl/perl5/commit/4d4eaa2cb3eb05793dc301178e47fe89488a88f0
  Author: James E Keenan <[email protected]>
  Date:   2022-08-10 (Wed, 10 Aug 2022)

  Changed paths:
    M pod/perlfunc.pod

  Log Message:
  -----------
  Document C<local *STDOUT> as an alternative to C<select ... select>

If one needs to temporarily "capture" the output of C<print>, for example
as part of a unit test, the classic "obvious" approach has been to use
C<select> before and afterwards, to set a different default output handle
and the restore the previous handle.

If one is already in the mindset of C<select>, it might not be obvious
that C<local *STDOUT> is alternative way to achieve the underlying goal,
and might be clearer and more robust. Hence add it as a suggestion in the
C<select> documentation.

For: https://github.com/Perl/perl5/pull/19225; reconciling different
approaches developed by @nwc10 and @leonerd.


Reply via email to