- 论坛徽章:
- 0
|
回复 4# dqchen0004
store( $scalar )
This method stores $scalar into shared memory. $scalar may be arbitrarily long. Shared memory segments are acquired and released automatically as the data length changes. The only limits on the amount of data are the system-wide limits on shared memory pages (SHMALL) and segments (SHMMNI) as compiled into the kernel.
The method raises an exception on error.
Note that unlike IPC::Shareable, this module does not automatically allow references to be stored. Serializing all data is expensive, and is not always necessary. If you need to store a reference, you should employ the Storable module yourself. For example:
use Storable qw( freeze thaw );
...
$hash = { red => 1, white => 1, blue => 1 };
$share->store( freeze( $hash ) );
...
$hash = thaw( $share->fetch ); |
|