From 948ecc4079304ff4b8604b45d6d9315279e4796e Mon Sep 17 00:00:00 2001 From: Chip Salzenberg Date: Thu, 6 Mar 1997 07:48:16 +1200 Subject: Improve IO::Handle docs; don't export _open_mode_string --- ext/IO/lib/IO/File.pm | 7 +++--- ext/IO/lib/IO/Handle.pm | 59 +++++++++++++++++++++++++++++++------------------ 2 files changed, 41 insertions(+), 25 deletions(-) (limited to 'ext/IO') diff --git a/ext/IO/lib/IO/File.pm b/ext/IO/lib/IO/File.pm index c194a0dead..9d647b3571 100644 --- a/ext/IO/lib/IO/File.pm +++ b/ext/IO/lib/IO/File.pm @@ -108,7 +108,6 @@ use vars qw($VERSION @EXPORT @EXPORT_OK $AUTOLOAD @ISA); use Carp; use Symbol; use SelectSaver; -use IO::Handle qw(_open_mode_string); use IO::Seekable; require Exporter; @@ -116,7 +115,7 @@ require DynaLoader; @ISA = qw(IO::Handle IO::Seekable Exporter DynaLoader); -$VERSION = "1.06"; +$VERSION = "1.0601"; @EXPORT = @IO::Seekable::EXPORT; @@ -166,8 +165,8 @@ sub open { defined $perms or $perms = 0666; return sysopen($fh, $file, $mode, $perms); } - $file = "./" . $file unless $file =~ m#^/#; - $file = _open_mode_string($mode) . " $file\0"; + $file = './' . $file unless substr($file, 0, 1) eq '/'; + $file = IO::Handle::_open_mode_string($mode) . " $file\0"; } open($fh, $file); } diff --git a/ext/IO/lib/IO/Handle.pm b/ext/IO/lib/IO/Handle.pm index 43805c30f7..f270f3ff98 100644 --- a/ext/IO/lib/IO/Handle.pm +++ b/ext/IO/lib/IO/Handle.pm @@ -58,16 +58,6 @@ to the caller. =head1 METHODS -If the C function setvbuf() is available, then C -sets the buffering policy for the IO::Handle. The calling sequence -for the Perl function is the same as its C counterpart, including the -macros C<_IOFBF>, C<_IOLBF>, and C<_IONBF>, except that the buffer -parameter specifies a scalar variable to use as a buffer. WARNING: A -variable used as a buffer by C must not be -modified in any way until the IO::Handle is closed or until -C is called again, or memory corruption may -result! - See L for complete descriptions of each of the following supported C methods, which are just front ends for the corresponding built-in functions: @@ -105,6 +95,16 @@ Furthermore, for doing normal I/O you might need these: =over +=item $fh->fdopen ( FD, MODE ) + +C is like an ordinary C except that its first parameter +is not a filename but rather a file handle name, a IO::Handle object, +or a file descriptor number. + +=item $fh->opened + +Returns true if the object is currently a valid file descriptor. + =item $fh->getline This works like <$fh> described in L @@ -117,25 +117,44 @@ This works like <$fh> when called in an array context to read all the remaining lines in a file, except that it's more readable. It will also croak() if accidentally called in a scalar context. -=item $fh->fdopen ( FD, MODE ) +=item $fh->ungetc ( ORD ) -C is like an ordinary C except that its first parameter -is not a filename but rather a file handle name, a IO::Handle object, -or a file descriptor number. +Pushes a character with the given ordinal value back onto the given +handle's input stream. =item $fh->write ( BUF, LEN [, OFFSET }\] ) -C is like C found in C, that is it is the +This C is like C found in C, that is it is the opposite of read. The wrapper for the perl C function is called C. -=item $fh->opened +=item $fh->flush -Returns true if the object is currently a valid file descriptor. +Flush the given handle's buffer. + +=item $fh->error + +Returns a true value if the given handle has experienced any errors +since it was opened or since the last call to C. + +=item $fh->clearerr + +Clear the given handle's error indicator. =back -Lastly, a special method for working under B<-T> and setuid/gid scripts: +If the C functions setbuf() and/or setvbuf() are available, then +C and C set the buffering +policy for an IO::Handle. The calling sequences for the Perl functions +are the same as their C counterparts--including the constants C<_IOFBF>, +C<_IOLBF>, and C<_IONBF> for setvbuf()--except that the buffer parameter +specifies a scalar variable to use as a buffer. WARNING: A variable +used as a buffer by C or C must not be modified in any +way until the IO::Handle is closed or C or C is called +again, or memory corruption may result! + +Lastly, there is a special method for working under B<-T> and setuid/gid +scripts: =over @@ -186,7 +205,7 @@ use SelectSaver; require Exporter; @ISA = qw(Exporter); -$VERSION = "1.1503"; +$VERSION = "1.1504"; $XS_VERSION = "1.15"; @EXPORT_OK = qw( @@ -215,8 +234,6 @@ $XS_VERSION = "1.15"; _IOFBF _IOLBF _IONBF - - _open_mode_string ); -- cgit v1.2.1