SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

BotDetect - Real-Time Bot Detection API
 
 

MAN page from Old RedHat 5.X perl-5.004-4.i386.rpm

IO::Handle

Section: Perl Programmers Reference Guide (3)
Updated: perl 5.004, patch 04
Index 

NAME

IO::Handle - supply object methods for I/O handles 

SYNOPSIS

    use IO::Handle;
    $fh = new IO::Handle;    if ($fh->fdopen(fileno(STDIN),"r")) {        print $fh->getline;        $fh->close;    }
    $fh = new IO::Handle;    if ($fh->fdopen(fileno(STDOUT),"w")) {        $fh->print("Some text\n");    }
    use IO::Handle '_IOLBF';    $fh->setvbuf($buffer_var, _IOLBF, 1024);
    undef $fh;       # automatically closes the file if it's open
    autoflush STDOUT 1;
 

DESCRIPTION

IO::Handle is the base class for all other IO handle classes. It isnot intended that objects of IO::Handle would be created directly,but instead IO::Handle is inherited from by several other classesin the IO hierarchy.

If you are reading this documentation, looking for a replacement forthe FileHandle package, then I suggest you read the documentationfor IO::File

A IO::Handle object is a reference to a symbol (see the Symbol package) 

CONSTRUCTOR


new ()
Creates a new IO::Handle object.
new_from_fd ( FD, MODE )
Creates a IO::Handle like new does.It requires two parameters, which are passed to the method fdopen;if the fdopen fails, the object is destroyed. Otherwise, it is returnedto the caller.
 

METHODS

See the perlfunc manpage for complete descriptions of each of the followingsupported IO::Handle methods, which are just front ends for thecorresponding built-in functions:

    close    fileno    getc    eof    read    truncate    stat    print    printf    sysread    syswrite
See the perlvar manpage for complete descriptions of each of the followingsupported IO::Handle methods:

    autoflush    output_field_separator    output_record_separator    input_record_separator    input_line_number    format_page_number    format_lines_per_page    format_lines_left    format_name    format_top_name    format_line_break_characters    format_formfeed    format_write
Furthermore, for doing normal I/O you might need these:
$fh->fdopen ( FD, MODE )
fdopen is like an ordinary open except that its first parameteris not a filename but rather a file handle name, a IO::Handle object,or a file descriptor number.
$fh->opened
Returns true if the object is currently a valid file descriptor.
$fh->getline
This works like <$fh> described in the section on I/O Operators in the perlop manpageexcept that it's more readable and can be safely called in anarray context but still returns just one line.
$fh->getlines
This works like <$fh> when called in an array context toread all the remaining lines in a file, except that it's more readable.It will also croak() if accidentally called in a scalar context.
$fh->ungetc ( ORD )
Pushes a character with the given ordinal value back onto the givenhandle's input stream.
$fh->write ( BUF, LEN [, OFFSET }\] )
This write is like write found in C, that is it is theopposite of read. The wrapper for the perl write function iscalled format_write.
$fh->flush
Flush the given handle's buffer.
$fh->error
Returns a true value if the given handle has experienced any errorssince it was opened or since the last call to clearerr.
$fh->clearerr
Clear the given handle's error indicator.

If the C functions setbuf() and/or setvbuf() are available, thenIO::Handle::setbuf and IO::Handle::setvbuf set the bufferingpolicy for an IO::Handle. The calling sequences for the Perl functionsare the same as their C counterparts---including the constants _IOFBF,_IOLBF, and _IONBF for setvbuf()--except that the buffer parameterspecifies a scalar variable to use as a buffer. WARNING: A variableused as a buffer by setbuf or setvbuf must not be modified in anyway until the IO::Handle is closed or setbuf or setvbuf is calledagain, or memory corruption may result! Note that you need to importthe constants _IOFBF, _IOLBF, and _IONBF explicitly.

Lastly, there is a special method for working under -T and setuid/gidscripts:

$fh->untaint
Marks the object as taint-clean, and as such data read from it will alsobe considered taint-clean. Note that this is a very trusting action totake, and appropriate consideration for the data source and potentialvulnerability should be kept in mind.
 

NOTE

A IO::Handle object is a GLOB reference. Some modules thatinherit from IO::Handle may want to keep object related variablesin the hash table part of the GLOB. In an attempt to prevent modulestrampling on each other I propose the that any such module should prefixits variables with its own name separated by _'s. For example the IO::Socketmodule keeps a timeout variable in `io_socket_timeout'. 

SEE ALSO

the perlfunc manpage, the section on I/O Operators in the perlop manpage,the IO::File manpage 

BUGS

Due to backwards compatibility, all filehandles resemble objectsof class IO::Handle, or actually classes derived from that class.They actually aren't. Which means you can't derive your own class from IO::Handle and inherit those methods. 

HISTORY

Derived from FileHandle.pm by Graham Barr <bodgAATTtiuk.ti.com>


 

Index

NAME
SYNOPSIS
DESCRIPTION
CONSTRUCTOR
METHODS
NOTE
SEE ALSO
BUGS
HISTORY

This document was created byman2html,using the manual pages.
 
ICM Bot detect detector