IPC-MM
view release on metacpan or search on metacpan
$mm = mm_create($MMSIZE, $MM_FILE);
$scalar = mm_make_scalar($mm);
tie $tied_scalar, 'IPC::MM::Scalar', $scalar;
$tied_scalar = 'hello';
$btree = mm_make_btree_table($mm);
tie %tied_hash, 'IPC::MM::BTree', $btree;
$tied_hash{key} = 'val';
$hash = mm_make_hash($mm);
tie %tied_hash, 'IPC::MM::Hash', $hash;
$tied_hash{key} = 'val';
$num = mm_maxsize();
$num = mm_available($mm);
$errstr = mm_error();
mm_display_info($mm);
mm_destroy($mm);
=head1 DESCRIPTION
IPC::MM provides an interface to Ralf Engelschall's mm library, allowing
memory to be shared between multiple processes in a relatively convenient
way.
IPC::MM provides methods to create and destoy shared memory segments and to
access data structures within those shared memory segments, as well as
miscellaneous methods. Additionally, it provides a tied interface for
scalars and hashes.
=head1 METHODS
=over 4
=item $mm = mm_create($size, $file)
This method creates a shared memory segment. It corresponds to the function
in B<mm> of the same name.
I<$size> is the size of the shared memory segment, in bytes. A size of 0 means
to allocate the maximum allowed size which is platform dependent.
I<$file> is a filesystem path to a file which may be used as a lock file for
synchronizing access.
=item $rc = mm_permission($mm, $mode, $owner, $group)
This method sets the filesystem mode, owner, and group for the shared
memory segment mm. It will only do anything when the underlying shared
memory segment is based on files. It corresponds to the function in B<mm>
of the same name.
I<$mm> is the shared memory segment returned by I<mm_create>.
I<$mode>, I<$owner>, and I<$group> are passed directly to chown and chmod.
=item mm_destroy($mm)
This method destroys a shared memory segment created by I<mm_create>.
I<$mm> is the shared memory segment returned by I<mm_create>.
=item $scalar = mm_make_scalar($mm)
=item mm_free_scalar($scalar)
=item $val = mm_scalar_get($scalar)
=item $rc = mm_scalar_set($scalar, $val)
This family of methods provides a data structure for use by scalar variables.
I<mm_make_scalar> allocates the data structure used by the scalar.
I<mm_free_scalar> frees a data structure created by I<mm_make_scalar>.
I<mm_scalar_get> returns the contents of the scalar, I<$scalar>.
I<mm_scalar_set> sets the contents of the scalar, I<$scalar>, to I<$val>.
I<$val> is simply a Perl scalar value, meaning that it can be a string,
a number, a reference, et al.
It is possible for I<mm_scalar_set> to fail if there is not enough shared
memory.
It is possible to make the scalar a tied variable, like so:
tie $tied_scalar, 'IPC::MM::Scalar', $scalar;
=item $btree = mm_make_btree_table($mm)
=item mm_clear_btree_table($btree)
=item mm_free_btree_table($btree)
=item $val = mm_btree_table_get($btree, $key)
=item $rc = mm_btree_table_insert($btree, $key, $val)
=item $oldval = mm_btree_table_delete($btree, $key)
=item $rc = mm_btree_table_exists($btree, $key)
=item $key = mm_btree_table_first_key($btree)
=item $key = mm_btree_table_next_key($btree, $key)
This family of methods provides a btree data structure for use by hashes.
I<mm_make_btree_table> allocates the data structure.
I<mm_clear_btree_table> clears the data structure, making it empty.
I<mm_free_btree_table> frees the data structure.
( run in 0.794 second using v1.01-cache-2.11-cpan-71847e10f99 )