While attractive, this is just one more way of
tieing the STDERR glob. Because this nor any of the other
tie methods 'really' hook into the
filehandle used by STDERR they don't help capture the low-level references to STDERR (aka
fileno(STDERR)==2) done by code like
Devel::Peek.
Tested with the following code it fails the "warn test" and testing versus Mr. Muskrat's target Devel::Peek:
use IO::Capture::Stderr;
use Devel::Peek;
my $data;
print STDERR " STDERR test (1)\n";
my $capture = IO::Capture::Stderr->new();
$capture->start();
print STDERR " STDERR test (2)\n";
warn " STDERR test (2a)";
my $test = 'string';
Dump($test);
$capture->stop();
print STDERR " STDERR test (3)\n";
my @the_output = $capture->read;
if( @the_output ) {
foreach (@the_output) {
print " >>> ", $_;
}
}
produces output
STDERR test (1)
STDERR test (2a) at mrmskrat4.pl line 15.
SV = PV(0x183ec0c) at 0x197138c
REFCNT = 1
FLAGS = (PADBUSY,PADMY,POK,pPOK)
PV = 0x196deb4 "string"\0
CUR = 6
LEN = 7
STDERR test (3)
>>> STDERR test (2)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.