MAN page from Mandrake Other perl-IO-File-Multi-1.02-1.i386.rpm
Multi
Section: User Contributed Perl Documentation (3)
Updated: perl 5.004, patch 04
Index NAME
Multi - Print to multiple filehandles with one output call
SYNOPSIS
use IO::File::Multi; $mult_obj=new IO::File::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 IO::File 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 IO::File::Multi; $mh=new IO::File::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 IO::File module also applyhere.
It has been pointed out to me that multiple open() calls on the same fileunder MacOS will fail. Hopefully, the carp() call will help with catchingthis.
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.