MCE::Shared::Scalar - Scalar helper class
This document describes MCE::Shared::Scalar version 1.699_008
# non-shared use MCE::Shared::Scalar; my $var = MCE::Shared::Scalar->new( $val ); # shared use MCE::Shared; my $var = MCE::Shared->scalar( $val ); # oo interface $val = $var->set( $val ); $val = $var->get(); $len = $var->len(); # sugar methods without having to call set/get explicitly $val = $var->append( $string ); # $val .= $string $val = $var->decr(); # --$val $val = $var->decrby( $number ); # $val -= $number $val = $var->getdecr(); # $val-- $val = $var->getincr(); # $val++ $val = $var->incr(); # ++$val $val = $var->incrby( $number ); # $val += $number $old = $var->getset( $new ); # $o = $v, $v = $n, $o
Helper class for MCE::Shared.
Construct a new scalar object. The value defaults to undef unless value is specified.
undef
Set scalar to value.
Get the scalar value.
Get the length of the scalar value.
This module is equipped with sugar methods to not have to call set and get explicitly. The API resembles a subset of the Redis primitives http://redis.io/commands#strings without the key argument.
set
get
Append the value at the end of the scalar value.
Decrement the value by one and return its new value.
Decrement the value by the given number and return its new value.
Decrement the value by one and return its old value.
Increment the value by one and return its old value.
Set to value and return its old value.
Increment the value by one and return its new value.
Increment the value by the given number and return its new value.
The implementation is inspired by Tie::StdScalar.
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.