File: sharelite_with_sereal.pl

package info (click to toggle)
libipc-shareable-perl 1.13-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 440 kB
  • sloc: perl: 1,225; makefile: 9
file content (30 lines) | stat: -rw-r--r-- 510 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use warnings;
use strict;
use feature 'say';

use Data::Dumper;
use Sereal qw(encode_sereal decode_sereal);
use IPC::ShareLite;

my %shm_opts = (
    -key        => 'test',
    -create     => 1,
    -destroy    => 1,
    -exclusive  => 0,
    -mode       => 0666,
#    -flags      => $flags,
    -size       => 999
);

my $s = IPC::ShareLite->new(%shm_opts);

my %hash = (a => 1, b => 2);

$s->store(encode_sereal(\%hash));
my $d = decode_sereal($s->fetch);

print Dumper $d;

print Dumper $s;

say $s->shmid;