Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^6: STDERR going to string

by philkime (Sexton)
on Oct 11, 2011 at 09:49 UTC ( #930769=note: print w/ replies, xml ) Need Help??


in reply to Re^5: STDERR going to string
in thread STDERR going to string

I don't think I understand how to do that in my case. I am in the middle of a large program and need to make some sub calls to some XS/external lib subs. There isn't anything I can really launch as an external processs here. Am I missing something? I know it'll always work if I redirect everything before I start but my problem is that I am already deep in some code at the point where I need to run some XS subs and get their STDERR.


Comment on Re^6: STDERR going to string
Re^7: STDERR going to string
by Anonymous Monk on Oct 11, 2011 at 11:30 UTC

    Am I missing something?

    $ perl -le " print for map { fileno $_ } \*STDIN, \*STDOUT, \*STDERR +" 0 1 2

    There is nothing you can do to change the fileno of STDIN/STDOUT/STDERR on a c-level on win32, they're always 0 1 2, so any c code printing on STDERR is printing on 2, always

    To capture STDERR you have to launch a process, or

    Patch XS module to use perl functions for printing to stderr (perlclib), so that when you redirect STDERR/STDOUT (like using IO::NestedCapture), it notices

      Ok, thanks. I looked into patching but the STDERR stuff comes from a library which the XS uses, not the XS itself. To perlIO that would probably be too tricky (for me, anyway). I wonder if I could get round it with a simple fork() around the sub calls ...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://930769]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2014-10-26 09:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (153 votes), past polls