http://qs1969.pair.com?node_id=1105529


in reply to capturing stderr of echo piped to a file

Here is how I've done it in test files:

# Capture any STDERR output my $stderr = ''; local *STDERR; open STDERR, '>', \$stderr;
I can't remember where I first saw that, but I've kept it handy ever since.

You must always remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.

Replies are listed 'Best First'.
Re^2: capturing stderr of echo piped to a file
by Anonymous Monk on Oct 29, 2014 at 23:52 UTC
    That isn't as portable/reliable as Capture::Tiny, there are many such modules ... Capture::Tiny got created pretty late in the game but its the best of the best

      Agreed. I was simply showing a way to do it that I found handy back before then in response to the stated desire to avoid extra modules. I'm not even sure it would work in the situation given, but might be worth looking at.

      You must always remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.