++ed by:
POTATOGIM FUKAI AWNCORP MOCNII ADAMJS

40 PAUSE users
34 non-PAUSE users.

Mario Roy
and 1 contributors

NAME

MCE::Shared::Array - Class for sharing arrays via MCE::Shared

VERSION

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

SYNOPSIS

   # non-shared
   use MCE::Shared::Array;

   my $ar = MCE::Shared::Array->new( @list );

   # shared
   use MCE::Shared;

   my $ar = MCE::Shared->array( @list );

   # oo interface
   $val   = $ar->set( $idx, $val );
   $val   = $ar->get( $idx);
   $val   = $ar->delete( $idx );
   $bool  = $ar->exists( $idx );
   void   = $ar->clear();
   $len   = $ar->length();                    # scalar @{ $ar }
   $len   = $ar->length( $idx );              # length $ar->[ $idx ]
   $val   = $ar->pop();
   $len   = $ar->push( @list );
   $val   = $ar->shift();
   $len   = $ar->unshift( @list );
   @list  = $ar->splice( $offset, $length, @list );

   $ar2   = $ar->clone( @indices );           # @indices is optional
   $ar3   = $ar->flush( @indices );
   $iter  = $ar->iterator( @indices );        # ($idx, $val) = $iter->()
   $len   = $ar->mset( $idx/$val pairs );
   @vals  = $ar->mget( @indices );
   @keys  = $ar->keys( @indices );
   @vals  = $ar->values( @indices );
   %pairs = $ar->pairs( @indices );

   @vals  = $ar->sort();                      # $a <=> $b default
   @vals  = $ar->sort( "desc" );              # $b <=> $a
   @vals  = $ar->sort( "alpha" );             # $a cmp $b
   @vals  = $ar->sort( "alpha desc" );        # $b cmp $a

   %pairs = $ar->find( "val =~ /$pattern/i" );
   %pairs = $ar->find( "val !~ /$pattern/i" );

   %pairs = $ar->find( "val eq $string" );
   %pairs = $ar->find( "val ne $string" );
   %pairs = $ar->find( "val lt $string" );
   %pairs = $ar->find( "val le $string" );
   %pairs = $ar->find( "val gt $string" );
   %pairs = $ar->find( "val ge $string" );

   %pairs = $ar->find( "val == $number" );
   %pairs = $ar->find( "val != $number" );
   %pairs = $ar->find( "val <  $number" );
   %pairs = $ar->find( "val <= $number" );
   %pairs = $ar->find( "val >  $number" );
   %pairs = $ar->find( "val >= $number" );

   # sugar methods without having to call set/get explicitly
   $len   = $ar->append( $idx, $string );     #   $val .= $string
   $val   = $ar->decr( $idx );                # --$val
   $val   = $ar->decrby( $idx, $number );     #   $val -= $number
   $val   = $ar->incr( $idx );                # ++$val
   $val   = $ar->incrby( $idx, $number );     #   $val += $number
   $val   = $ar->pdecr( $idx );               #   $val--
   $val   = $ar->pincr( $idx );               #   $val++

DESCRIPTION

Helper class for MCE::Shared.

API DOCUMENTATION

To be completed before the final 1.700 release.

new
set
get
delete
exists
clear
length
pop
push
shift
unshift
splice
clone
flush
iterator
mget
mset
keys
values
pairs
find
sort
append
decr
decrby
incr
incrby
pdecr
pincr

CREDITS

Implementation inspired by Tie::StdArray.

INDEX

MCE, MCE::Core, MCE::Shared

AUTHOR

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