in reply to Re^3: Problems with Filehandles and TeeOutput
in thread Problems with Filehandles and TeeOutput
However I am actually trying to capture STDERR, so this code isn't that useful to me. I have tried IO::CaptureOutput but I can't get that working. Note apologies, as I know that this (capturing STDERR to local variable as well as directing to file) has been covered many times before perlmonks and elsewhere, but I haven't come across a definitive solution - I was hoping that TeeOutput would be the answer, I guess not.#!/usr/bin/perl -w use strict; use warnings; use IO::Tee; use IO::File; my $stdout; open(my $fh, "+<", \$stdout); my $tee = new IO::Tee(\*STDOUT, $fh); print $tee `echo Test`; print $stdout;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Problems with Filehandles and TeeOutput
by ikegami (Patriarch) on Aug 26, 2008 at 18:08 UTC |