Date sent: Mon, 22 Jun 2009 10:53:06 -0700
From: pa...@compugenic.com
To: beginners@perl.org
Subject:redirecting STDERR with IO::Tee
> I have a script which runs mostly via a cron job and sometimes
> interactively. I would like ST
On Wed, Jun 24, 2009 at 05:52:36PM +0800, Jeff Pang wrote:
> 2009/6/23 :
> > I have a script which runs mostly via a cron job and sometimes
> > interactively. I would like STDERR to automatically print to both the
> > console and to a logfile simultaneously.
>
> Hi,
>
> What causes writting
2009/6/23 :
> I have a script which runs mostly via a cron job and sometimes interactively.
> I would like STDERR to automatically print to both the console and to a
> logfile simultaneously.
>
> Right now I've gotten as far as merging both file handles with IO::Tee but
> I'm not sure if I'm h
Opening the filehandle STDERR to a file will not persist beyond termination of
the script, nor will it affect other programs running at the same time as the
script. It affects only the running script. STDERR of the shell is different
from that of perl.
On Friday 07 October 2005 16:56, Timothy J
hi,
maybe u should redefined the __DIE__ handle for the reason of safety.
such as:
$SIG{__DIE__}=\&log_die;
sub log_die
{
open (HDW,">>",$err_log);
select HDW;$|=1;select STDOUT;
print HDW @_;
close HDW;
die @_;
}
2005/10/8, Timothy Johnson <[EMAIL PROTECTED]>:
> It partly de
It partly depends on your operating system, I think. That's fine on
Windows, but on UNIX I think that under some if not all circumstances
your change will persist after the script finishes executing. I've
never had to do it, but I've seen one method that goes like this:
open(OLD_STDERR,">&STDERR
Try the Module IO::Tee, I haven't used it, but it's description sounds to be
what you need
> -Original Message-
> From: Peter Scott [mailto:[EMAIL PROTECTED]]
> Sent: 13 November 2001 07:01
> To: [EMAIL PROTECTED]
> Subject: Re: Redirecting STDERR to 2
>I have been trying to figure out if it possible to redirect STDERR to 2
>locations at once. Specifically, I want certain errors to be redirected
>to both STDOUT and a log file. I have been unable to do this, and am not
>even sure it is possible.
>
>Redirecting to one or the other is now pro
At 05:24 PM 11/12/01 -0500, you wrote:
>>I have been trying to figure out if it possible to redirect STDERR to 2
>>locations at once. Specifically, I want certain errors to be redirected
>>to both STDOUT and a log file. I have been unable to do this, and am not
>>even sure it is possible.
>>