home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

11.7 The FileHandle Module

Because Perl was designed to be a practical extraction and report language, formats were one of the earliest constructs incorporated into the language. As such, the format interface is starting to show its age, particularly when you have to resort to ugly variable names and esoteric select manipulations merely to switch the currently active format.

The FileHandle module provides a more intuitive approach to these matters. For example, here's the easy way to perform the same manipulations we demonstrated earlier in the section "Changing the Format Name ."

use FileHandle; # load library

format_name REPORT "ADDRESSLABEL";
write REPORT;

format_name REPORT "SUMMARY";
write REPORT;

This object-oriented module lets you treat filehandles as though they were objects.[ 5 ] All the filehandle-specific built-in punctuation variables have more mnemonic interfaces. See Chapter 2 of Programming Perl , or the perlform documentation, for the complete description of these.

[5] See Chapter 18, CGI Programming , for more explanation about objects.











??????????????@Mail.ru