Proc::ForkSafe - help make objects fork safe
use Proc::ForkSafe; package MyPersistentTCPClient { sub new { ... } sub request { ... } } my $client = Proc::ForkSafe->wrap(sub { MyPersistentTCPClient->new }); my $res = $client->call(request => @some_argv); my $pid = fork // die; if ($pid == 0) { # in child process, $client will be reinitialized my $res2 = $client->call(request => @some_argv); ... exit; } waitpid $pid, 0;
Proc::ForkSafe helps make objects fork safe.
Copyright 2023 Shoichi Kaji <skaji@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Proc::ForkSafe, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Proc::ForkSafe
CPAN shell
perl -MCPAN -e shell install Proc::ForkSafe
For more information on module installation, please visit the detailed CPAN module installation guide.