--- Bob Mangold <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> I sent an email yesterday, but never heard anything. Maybe it was the
> word 'php' in the subject, but let me just simplify and ask another
> way.
> 
> Is there a way to automatically direct all STDERR output to STDOUT. A
> module I have installed automatically creates STDERR output, but I
> want that output to go to the filehandle STDOUT.

You can just alias them, dup'ing is probably best

  open STDERR, ">&STDOUT" or die $!;

STDERR usually isn't buffered, so that shouldn't be an issue.
If you want to try a slightly sloppier way, you could say

   *STDERR = *STDOUT;

The advantage of that is that you can localize it to a block:

   if ($condition) {
      use YourModule;
      local *STDERR = *STDOUT; # gets reinstated at end of if block
      while (YourModule->doesStuff()) {
         thisGetsRedirected();
      }
   } # at this point the block scope closes, and STDERR gets replaced

Somebody flame me a little if I'm smoking crack on this one? =o)

=====
print "Just another Perl Hacker\n"; # edited for readability =o)
=============================================================
Real friends are those whom, when you inconvenience them, are bothered less by it than 
you are. -- me. =o) 
=============================================================
"There are trivial truths and there are great Truths.
 The opposite of a trival truth is obviously false.
 The opposite of a great Truth is also true."  -- Neils Bohr

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Reply via email to