diff -r 000000000000 -r 42188c7ea2d9 Orb/Doxygen/DITA/plugins/apiref/sample/FileHandle.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orb/Doxygen/DITA/plugins/apiref/sample/FileHandle.dita Thu Jan 21 17:29:01 2010 +0000 @@ -0,0 +1,105 @@ + + + +FileHandle class +Supply object methods for filehandles. + + +my $fh = new FileHandle(name, mode); + +name +The filename for the accessed file. + + +mode +How the file is accessed including r for read and w for +write. + + +The FileHandle class manages input and output operations for files. +When the object is scavenged, the file is closed. +
my @lines;
+my $fh = new FileHandle("filename.txt", "r");
+if (defined $fh) {
+	@lines = $fh->getlines();
+	undef $fh;
+}

The example opens a text file, reads all of the lines from the file +into an array, and closes the file.

+
+ +autoflush variable + + + +$fh->autoflush = expression; + +expression +0 to flush output only on request, 1 to flush output after every +write. + + + + + +input_record_separator variable +The input record separator, which is a newline by default. + + +$fh->input_record_separator = undef; + +You can set input_record_separator to a multi-character string to +match a multi-character terminator or to undef to read through +the end of file. + + + +print subroutine +Prints a string or a list of strings to a file. + + +$fh->print(string, ...); + +string +One or more strings for printing to the file. + + + + + +printf subroutine +Prints a string to a file formatted by the usual conventions of +the C library function. + + +$fh->printf(format, string, ...); + +format +A string with tokens for interpolating and formatting strings. + + +string +One or more strings to interpolate. + + + + + +getline subroutine +Yields the next line from that file (the newline, if any, included). + + +$fh->getline; + + + + +getlines subroutine +Reads all of the remaining lines from a file as a list. + + +$fh->getlines; + + + +