MAN page from Old RedHat 6.X perl-FileHandle-Multi-1.00-6.i386.rpm
Multi
Section: User Contributed Perl Documentation (3)
Updated: perl 5.005, patch 03
Index NAME
Multi - Print to multiple filehandles with one output call
SYNOPSIS
use FileHandle::Multi; $mult_obj=new FileHandle::Multi; $mult_obj->open('>-'); $mult_obj->open('>file'); $mult_obj->open(">$file"); $mult_obj->open('>>file2'); $mult_obj->print("This will be printed to several filehandles\n"); $mult_obj->printf("This will be printed to %d filehandles\n", scalar @{$mult_obj->{handles}}); $mult_obj->autoflush(); @handle_refs = $mult_obj->members(); $mult_obj->output_field_separator(':'); $mult_obj->output_record_separator('\n'); $mult_obj->format_page_number(2); $mult_obj->format_lines_per_page(66); $mult_obj->format_lines_left(10); $mult_obj->format_name('AN_REPORT'); $mult_obj->format_top_name('AN_REPORT_TOP'); $mult_obj->format_line_break_characters('\n'); $mult_obj->format_formfeed('\l'); $mult_obj->close(); DESCRIPTION
This module requires that the user have the FileHandle module installed (itcomes with the perl distribution). Create objects for each of the outputfilehandles you'll have - then call the
print() and
printf() methods tosend output to ALL the filehandles associated with an object.
EXAMPLES
Look at the
SYNOPSIS section. Also, here is a simple implementationof the unix
tee(1) program (non-append mode):
#!/local/bin/perl use Multi; $mh=new Multi; $mh->open('>-'); for (@ARGV) { $mh->open(">$_"); } while (<STDIN>) { $mh->print($_); } BUGS
I don't think using
my()s the way I am in the
open() method is all thatgood. binmode isn't supported, but I don't see anybody using that anyways.In order to use
fcntl(),
fileno(), or
flock() you'll have to access thefilehandles yourself by calling
members(). There's no
write() yet (but I'mworking on it!). Also, any limitations to the FileHandle module also applyhere.
AUTHOR
Nem W Schlecht (nemAATTplains.nodak.edu). Comments, bugs fixes, andsuggestions welcome.
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- EXAMPLES
- BUGS
- AUTHOR
This document was created byman2html,using the manual pages.