Phil Rafferty <> wrote:
> When a script is executed STDOUT and/or STDERR may be redirected as
> follows: 
> 
>    perl script.pl  > log.txt   or
>    perl script.pl 2> log.txt   or
>    perl script.pl |  taker.pl  etc,
> 
> and all the other variations.
> 
> My question is this:
> 
> Can I find out
>   1) whether redirection has been specified?
>   2) if it has, which handle - STDOUT and/or STDERR - has been
>   redirected? 3) and also, if redirected to a file or another script,
>      the name of the file or script?

Redirection of STDOUT/STDERR/STDIN is handled by command shells, and
outside the scope of the process being exec uted. In general, I don't
think that it is possible for a process to know where its STDOUT is
directed. It is sometimes possible to determine whether STDOUT is a
terminal device, but that tends to be system dependent.

> 
> *any* clues would be most appreciated.

It might help if you could say why you want that information. An
alternate solution may be possible.

HTH

-- 
Brian Raven




=================================
Atos Euronext Market Solutions Disclaimer
=================================
The information contained in this e-mail is confidential and solely for the 
intended addressee(s). Unauthorised reproduction, disclosure, modification, 
and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message do not 
necessarily reflect those of Atos Euronext Market Solutions.

L'information contenue dans cet e-mail est confidentielle et uniquement 
destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. 
Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail 
vous parvient par erreur, nous vous prions de bien vouloir prevenir 
l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre 
systeme. Le contenu de ce message electronique ne represente pas necessairement 
la position ou le point de vue d'Atos Euronext Market Solutions.


_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to