| 1 |
use warnings; |
| 2 |
use strict; |
| 3 |
use feature 'say'; |
| 4 |
|
| 5 |
use Data::Dumper; |
| 6 |
use Sereal qw(encode_sereal decode_sereal); |
| 7 |
use IPC::ShareLite; |
| 8 |
|
| 9 |
my %shm_opts = ( |
| 10 |
-key => 'test', |
| 11 |
-create => 1, |
| 12 |
-destroy => 1, |
| 13 |
-exclusive => 0, |
| 14 |
-mode => 0666, |
| 15 |
# -flags => $flags, |
| 16 |
-size => 999 |
| 17 |
); |
| 18 |
|
| 19 |
my $s = IPC::ShareLite->new(%shm_opts); |
| 20 |
|
| 21 |
my %hash = (a => 1, b => 2); |
| 22 |
|
| 23 |
$s->store(encode_sereal(\%hash)); |
| 24 |
my $d = decode_sereal($s->fetch); |
| 25 |
|
| 26 |
print Dumper $d; |
| 27 |
|
| 28 |
print Dumper $s; |
| 29 |
|
| 30 |
say $s->shmid; |