in reply to redirecting output to STDERR and STDOUT

Are you saying you wont the module to print to STDOUT and STDERR? If so your going to need to get under the hood of the module and work it out from there as the module is set to print to the files specified I guess. If other code is dependent on this module you might think twice before going down this line.
  • Comment on Re: redirecting output to STDERR and STDOUT

Replies are listed 'Best First'.
Re^2: redirecting output to STDERR and STDOUT
by Anonymous Monk on Feb 22, 2005 at 19:15 UTC
    Thank you all for your help. Having researched this program a little further, I'm afraid that what actually needs to be done is a change to a program written in C which is called by the .pm that the perlscript I'm working in calls. It just doesn't appear that the C program allowed for this possibility. Blame it on poor planning I guess. Anyway, thank you all for some excellent responses!
      If you are calling a C program, and need to separate and direct your STDOUT and STDERR, you might be able to do it with the IPC::Open3 module. Just an idea.

      I'm not really a human, but I play one on earth. flash japh
      On Solaris and Linux /dev/stdin, /dev/stdout, and /dev/stderr are device names for standard input, standard output, and standard error. /dev/stdin is occasionally useful when piping data to a recaltricant C program which doesn't read from standard input or recognise '-' as a synonym for standard input. Likewise for the others. In your case you would set $logfile = "/dev/stderr"; of course this will only help you if your OS supports /dev/stderr. /dev/fd/2 might be another option for standard error. On Solaris, man -s 4 fd for details.

        I can confirm that /dev/stdin and friends work on Linux.

        If you are on an otherwise unixy system that does not have these, you should be able to create a FIFO (a.k.a. named pipe) for each stream, spawn child processes to pipe them to STDOUT and STDERR, and hand the FIFO names to C. See "Named Pipes" in perlipc.

        Excellent! Using /dev/stdout and /dev/stderr did exactly what I needed it to do. Thank you!