[svn:perlfaq] r6478 - perlfaq/trunk
[email protected] Wed, 7 Jun 2006 00:40:14 -0700 (PDT)
| Newsgroups | perl.cvs.perlfaq |
|---|---|
| Message-ID | <[email protected]> |
Author: comdog
Date: Wed Jun 7 00:40:12 2006
New Revision: 6478
Modified:
perlfaq/trunk/perlfaq8.pod
Log:
* Removed IO::Interactive example. While playing with this module, I
discovered that it doesn't actually work. It looks at @ARGV to make
part of it's decision, which causes it to fail. Any script which
takes command line arguments but doesn't use the line input operator
will cause is_interactive to give the wrong answer.
Modified: perlfaq/trunk/perlfaq8.pod
==============================================================================
--- perlfaq/trunk/perlfaq8.pod (original)
+++ perlfaq/trunk/perlfaq8.pod Wed Jun 7 00:40:12 2006
@@ -994,22 +994,13 @@
=head2 How do I find out if I'm running interactively or not?
-Good question. Sometimes C<-t STDIN> and C<-t STDOUT> can give clues,
+Good question. Sometimes C<-t STDIN> and C<-t STDOUT> can give clues,
sometimes not.
if (-t STDIN && -t STDOUT) {
print "Now what? ";
}
-The C<IO::Interactive> module provides some convenience functions. Its
-C<is_interactive()> gives you the right answer while handling the
-special cases behind-the-scenes. The C<interactive> function returns
-C<STDOUT> if the script is interactive and a dummy filehandle
-otherwise. This way, you never have to worry a about testing anything:
-
- use IO::Interactive;
- print {interactive()} "This prints only when interactive";
-
On POSIX systems, you can test whether your own process group matches
the current process group of your controlling terminal as follows: