++ed by:
DEMIAN SCHWIGON TOBYINK DRAEGTUN DANAJ

40 PAUSE users
34 non-PAUSE users.

Mario Roy
and 1 contributors

NAME

MCE::Shared::Handle - Class for sharing handles via MCE::Shared

VERSION

This document describes MCE::Shared::Handle version 1.699_002

SYNOPSIS

   # 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( \&parallel ) 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;

DESCRIPTION

Helper class for MCE::Shared.

API DOCUMENTATION

To be completed before the final 1.700 release.

new

CREDITS

Implementation inspired by Tie::StdHandle.

INDEX

MCE, MCE::Core, MCE::Shared

AUTHOR

Mario E. Roy, <marioeroy AT gmail DOT com>