Leon Timmermans > SysV-SharedMem-0.010 > SysV::SharedMem

Download:
SysV-SharedMem-0.010.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.010   Source  

NAME ^

SysV::SharedMem - SysV Shared memory made easy

VERSION ^

version 0.010

SYNOPSIS ^

 use SysV::SharedMem;

 shared_open my $mem, '/path', '+>', size => 4096;
 vec($mem, 1, 16) = 34567;
 substr $mem, 45, 11, 'Hello World';

DESCRIPTION ^

This module maps SysV shared memory into a variable that can be read just like any other variable, and it can be written to using standard Perl techniques such as regexps and substr, as long as they don't change the length of the variable.

FUNCTIONS ^

shared_open($var, $filename, $mode, %options)

Open a shared memory object named $filename and attach it to $var. The segment that will be opened is determined with this order of precedence: $options{id}, $options{key}, $filename, IPC_PRIVATE (create a new anonymous segment).

$filename must be the path to an existing file if defined. $mode determines the read/write mode; it works the same as in open.

Beyond that it can take a number of optional named arguments:

shared_remove($var)

Marks a memory object to be removed. Shared memory has kernel persistence so it has to be explicitly disposed of. One can still use the object after marking it for removal.

shared_stat($var)

Retrieve the properties of the shared memory object. It returns a hashref with these members:

shared_chmod($var, $modebits)

Change the (lower 9) modebits of the shared memory object.

shared_chown($var, $uid, $gid = undef)

Change the owning uid and optionally gid of the shared memory object.

shared_detach($var)

Detach the shared memory segment from this variable.

shared_identifier

Return the identifier for this shared memory segment

AUTHOR ^

Leon Timmermans <leont@cpan.org>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2010 by Leon Timmermans.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: