The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Build Status Coverage Status

NAME

Test::SharedObject - Data sharing in multi process.

SYNOPSIS

use strict;
use warnings;

use Test::More tests => 2;
use Test::SharedFork;
use Test::SharedObject;

my $shared = Test::SharedObject->new(0);
is $shared->get, 0;

my $pid = fork;
die $! unless defined $pid;
if ($pid == 0) {# child
    $shared->txn(sub {
        my $counter = shift;
        $counter++;
        return $counter;
    });
    exit;
}
wait;

is $shared->get, 1;

DESCRIPTION

Test::SharedObject provides atomic data operation between multiple process.

METHODS

LICENSE

Copyright (C) karupanerura.

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

AUTHOR

karupanerura karupa@cpan.org