Promise-Me
view release on metacpan or search on metacpan
my $name : shared;
# Initiate a value
my $location : shared = 'Tokyo';
# you can also use 'pshared'
my $favorite_programming_language : pshared = 'perl';
# You can share array, hash and scalar
my %preferences : shared;
my @names : shared;
2. calling "share"
my( $name, %prefs, @middle_names );
share( $name, %prefs, @middle_names );
Once shared, you can use those variables normally and their values will
be shared between the parent process and the asynchronous process.
For example:
my( $name, @first_names, %preferences );
share( $name, @first_names, %preferences );
$name = 'Momo Taro';
The value of $SHARE_MEDIUM is automatically initialised to "memory" if
the system, on which this module runs, supports IPC::SysV, or "mmap" if
you have Cache::FastMmap installed, or else to "file"
$SHARED_MEMORY_SIZE
This is the size in bytes of the shared memory block used for sharing
variables between the main process and the sub processes. This is used
when you share variables, such as:
my $name : shared;
my( $name, %prefs, @middle_names );
share( $name, %prefs, @middle_names );
See "SHARED VARIABLES"
SERIALISATION
Promise::Me uses the following supported serialiser to serialise shared
data across processes:
* CBOR
* Sereal
# Initiate a value
my $location : shared = 'Tokyo';
# you can also use 'pshared'
my $favorite_programming_language : pshared = 'perl';
# You can share array, hash and scalar
my %preferences : shared;
my @names : shared;
2\. calling [\"share\"](#share){.perl-module}
: my( $name, %prefs, @middle_names );
share( $name, %prefs, @middle_names );
Once shared, you can use those variables normally and their values will
be shared between the parent process and the asynchronous process.
For example:
my( $name, @first_names, %preferences );
share( $name, @first_names, %preferences );
$name = 'Momo Taro';
installed, or else to `file`
\$SHARED\_MEMORY\_SIZE
----------------------
This is the size in bytes of the shared memory block used for sharing
variables between the main process and the sub processes. This is used
when you share variables, such as:
my $name : shared;
my( $name, %prefs, @middle_names );
share( $name, %prefs, @middle_names );
See [\"SHARED VARIABLES\"](#shared-variables){.perl-module}
SERIALISATION
=============
[Promise::Me](https://metacpan.org/pod/Promise::Me){.perl-module} uses
the following supported serialiser to serialise shared data across
processes:
lib/Promise/Me.pm view on Meta::CPAN
# Initiate a value
my $location : shared = 'Tokyo';
# you can also use 'pshared'
my $favorite_programming_language : pshared = 'perl';
# You can share array, hash and scalar
my %preferences : shared;
my @names : shared;
=item 2. calling L</share>
my( $name, %prefs, @middle_names );
share( $name, %prefs, @middle_names );
=back
Once shared, you can use those variables normally and their values will be shared between the parent process and the asynchronous process.
For example:
my( $name, @first_names, %preferences );
share( $name, @first_names, %preferences );
$name = 'Momo Taro';
lib/Promise/Me.pm view on Meta::CPAN
=head2 $SHARE_MEDIUM
The value of C<$SHARE_MEDIUM> is automatically initialised to C<memory> if the system, on which this module runs, supports L<IPC::SysV>, or C<mmap>, or else to C<file>
=head2 $SHARED_MEMORY_SIZE
This is the size in bytes of the shared memory block used for sharing variables between the main process and the sub processes. This is used when you share variables, such as:
my $name : shared;
my( $name, %prefs, @middle_names );
share( $name, %prefs, @middle_names );
See L</"SHARED VARIABLES">
=head2 $USE_THREADS_SHARED
my $data : shared = '';
# Do some asynchronous activities with Promise::Me
or
( run in 0.604 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )