Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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 line 15.
SV = PV(0x183ec0c) at 0x197138c
  REFCNT = 1
  PV = 0x196deb4 "string"\0
  CUR = 6
  LEN = 7
 STDERR test (3)
  >>>  STDERR test (2)

In reply to Re: Re: Best Way to Redirect STDERR to a Scalar by shenme
in thread Best Way to Redirect STDERR to a Scalar by Mr. Muskrat

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • 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, 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, 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (9)
    As of 2018-06-22 10:24 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (124 votes). Check out past polls.