MCE::Shared::Handle - Handle helper class
This document describes MCE::Shared::Handle version 1.699_007
# non-shared use MCE::Shared::Handle; my $fh = MCE::Shared::Handle->new( "<", "sample.fasta" ); # shared use MCE::Shared; my $fh = MCE::Shared->handle( "<", "sample.fasta" ); # demo use MCE::Hobo; use MCE::Shared; my $ofh = MCE::Shared->handle( '>>', \*STDOUT ); my $ifh = MCE::Shared->handle( '<', '/path/to/input/file' ); # output is serialized (not garbled), but not ordered sub parallel { $/ = "\n"; # can set the input record separator while (my $line = <$ifh>) { printf {$ofh} "[%5d] %s", $., $line; } } MCE::Hobo->create( \¶llel ) for 1 .. 4; $_->join() for MCE::Hobo->list(); # handle functions my $bool = eof($ifh); my $off = tell($ifh); my $fd = fileno($ifh); my $char = getc($ifh); my $line = readline($ifh); binmode $ifh; seek $ifh, 10, 0; read $ifh, my($buf), 80; print {$ofh} "foo\n"; printf {$ofh} "%s\n", "bar"; open $ofh, ">>", \*STDERR; syswrite $ofh, "shared handle to STDERR\n"; close $ifh; close $ofh;
Helper class for MCE::Shared.
To be completed before the final 1.700 release.
Implementation inspired by Tie::StdHandle.
MCE, MCE::Core, MCE::Shared
Mario E. Roy, <marioeroy AT gmail DOT com>
To install MCE, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MCE
CPAN shell
perl -MCPAN -e shell install MCE
For more information on module installation, please visit the detailed CPAN module installation guide.