in reply to Tie *STDOUT, recursion error

See Tie::STDOUT and Capture::Tiny

Replies are listed 'Best First'.
Re^2: Tie *STDOUT, recursion error
by Superfox il Volpone (Sexton) on Apr 11, 2015 at 20:37 UTC
    thanks for the reply. I was looking to the source code of Tie::STDOUT. He basically solves it with something like:
    open(my $stdout, ">&", STDOUT); ... # in the overloaded method PRINT $stdout->print( @_ ); # this refers to the original STDOUT.
    I guess this opens a different underlying file handle, while my $oldhandle = STDOUT is an assignment/alias to the same file handle used by STDOUT.

    s.fox