The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Test::SharedFork - fork test

SYNOPSIS

    use Test::More tests => 200;
    use Test::SharedFork;

    my $pid = fork();
    if ($pid == 0) {
        # child
        Test::SharedFork->child;
        ok 1, "child $_" for 1..100;
    } elsif ($pid) {
        # parent
        Test::SharedFork->parent;
        ok 1, "parent $_" for 1..100;
        waitpid($pid, 0);
    } else {
        die $!;
    }

DESCRIPTION

Test::SharedFork is utility module for Test::Builder. This module makes forking test!

This module merges test count with parent process & child process.

METHODS

parent

call this class method, if you are parent

child

call this class method, if you are child.

you can call this method many times(maybe the number of your children).

fork

This method calls fork(2), and call child() or parent() automatically. Return value is pass through from fork(2).

AUTHOR

Tokuhiro Matsuno <tokuhirom slkjfd gmail.com>

yappo

SEE ALSO

Test::TCP, Test::Fork, Test::MultipleFork

LICENSE

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