NAME
Check::Fork - Check fork functionality.
SYNOPSIS
use Check::Fork qw(check_fork $ERROR_MESSAGE);
my $ret = check_fork($config_hr, $os);
print $ERROR_MESSAGE."\n";
DESCRIPTION
There is need of check for fork functionality in tests. Actually we have
many duplicated and not same check code in distributions. Sic!
Intent of this module is create common code for check and test all
behaviours. Extra thing is error message which describe issue.
SUBROUTINES
"check_fork"
my $ret = check_fork($config_hr, $os);
Check possibility of forking functionality on system.
Variable $config_hr is primarily for testing and default is
"\%Config::Config".
Variable $os is primarily for testing and default is $^O.
Return value is 1 as possible fork() or 0 as not possible fork(). If
return value is 0, set $ERROR_MESSAGE variable.
Returns 0/1.
ERRORS
check_fork():
Set $ERROR_MESSAGE variable if $ret is 0:
No fork() routine available.
$^O: No interpreter-based threading implementation.
$^O: No PERL_IMPLICIT_SYS ccflags set.
EXAMPLE
use strict;
use warnings;
use Check::Fork qw(check_fork $ERROR_MESSAGE);
if (check_fork()) {
print "We could fork.\n";
} else {
print "We couldn't fork.\n";
print "Error message: $ERROR_MESSAGE\n";
}
# Output on Unix with Config{'d_fork'} set:
# We could fork.
# Output on Unix without Config{'d_fork'} set:
# We couldn't fork.
# Error message: No fork() routine available.
# Output on Windows without $Config{'useithreads'} set:
# We couldn't fork.
# Error message: MSWin32: No interpreter-based threading implementation.
DEPENDENCIES
Config, Exporter, Readonly.
SEE ALSO
Check::Socket
Check socket functionality.
REPOSITORY
<https://github.com/michal-josef-spacek/Check-Fork>
AUTHOR
Michal Josef Å paÄek <mailto:skim@cpan.org>
<http://skim.cz>
LICENSE AND COPYRIGHT
© 2021-2022 Michal Josef Å paÄek
BSD 2-Clause License
VERSION
0.02