Subject: | Test::Builder breaks on 'forks' CPAN module |
When using Test::Builder with the CPAN distribution "forks"
(http://search.cpan.org/~rybskej/forks-0.20/) on a non-threaded perl, a
special ithreads "share" subroutine, conditionally defined by
Test::Builder, is incorrectly loaded.
This results in incorrect "Test output counter mismatch" warnings, as
exemplified by running the following test script on a non-threaded perl
with forks 0.20:
http://search.cpan.org/src/RYBSKEJ/forks-0.20/t/forks03.t
This problem is due to the following condition not being met
(Test::Builder 0.33, line 18):
# Load threads::shared when threads are turned on
if( $] >= 5.008 && $Config{useithreads} && $INC{'threads.pm'}) {
which then falls back to the following else case (Test::Builder 0.33,
line 61):
# 5.8.0's threads::shared is busted when threads are off.
# We emulate it here.
else {
*share = sub { return $_[0] };
*lock = sub { 0 };
}
This causes the working share and lock functions of forks (and
forks::shared) to be incorrectly overloaded.
The simplest and most portable solution to support the forks module
would be to modify the original condition statement to the following:
if( $] >= 5.006 && $INC{'threads.pm'}) {
This change would have no negative affect (compilation performance or
otherwise) to any applications or modules that use Test::Builder. I
have included a patch containing this modification with this report.
Subject: | test-builder_forks_patch.1 |
Message body not shown because it is not plain text.