[svn:perlfaq] r5913 - perlfaq/trunk

[email protected] Mon, 17 Apr 2006 11:14:45 -0700 (PDT)
Newsgroups perl.cvs.perlfaq
Message-ID <[email protected]>
Author: comdog
Date: Mon Apr 17 11:14:44 2006
New Revision: 5913

Modified:
   perlfaq/trunk/perlfaq5.pod

Log:
* How do I do a C<tail -f> in perl?
	+ Ido Trivizki pointed out that POSIX defers to IO::Handle for
	clearerr, so I removed the POSIX reference and added an IO::Handle
	one.

	+ added a couple more index entries

	+ cleaned up some pod.


Modified: perlfaq/trunk/perlfaq5.pod
==============================================================================
--- perlfaq/trunk/perlfaq5.pod	(original)
+++ perlfaq/trunk/perlfaq5.pod	Mon Apr 17 11:14:44 2006
@@ -967,7 +967,7 @@
 pipes, and tty devices work, but I<not> files.
 
 =head2 How do I do a C<tail -f> in perl?
-X<tail>
+X<tail> X<IO::Handle> X<File::Tail> X<clearerr>
 
 First try
 
@@ -975,7 +975,7 @@
 
 The statement C<seek(GWFILE, 0, 1)> doesn't change the current position,
 but it does clear the end-of-file condition on the handle, so that the
-next <GWFILE> makes Perl try again to read something.
+next C<< <GWFILE> >> makes Perl try again to read something.
 
 If that doesn't work (it relies on features of your stdio implementation),
 then you need something more like this:
@@ -988,12 +988,11 @@
 	  seek(GWFILE, $curpos, 0);  # seek to where we had been
 	}
 
-If this still doesn't work, look into the POSIX module.  POSIX defines
-the clearerr() method, which can remove the end of file condition on a
-filehandle.  The method: read until end of file, clearerr(), read some
-more.  Lather, rinse, repeat.
+If this still doesn't work, look into the C<clearerr> method
+from C<IO::Handle>, which resets the error and end-of-file states
+on the handle.
 
-There's also a File::Tail module from CPAN.
+There's also a C<File::Tail> module from CPAN.
 
 =head2 How do I dup() a filehandle in Perl?
 X<dup>