On 6/9/07, Beau Cox <[EMAIL PROTECTED]> wrote:

From within a perl script, how can I deternine if STDxxx is from/to a pipe?

You probably want a filetest. Maybe you want -p, which returns true if
the filehandle is a pipe:

   my $piped_output = -p STDOUT;
   my $piped_input = -p STDIN;

Many people want -t, which returns true if the filehandle is attached
to a tty (i.e., a person).

   my $interactive = (-t STDIN) && (-t STDOUT);

These filetests are documented in the perlfunc manpage under -X.

Cheers!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to