X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FTest%2FLeaner.pm;h=1efe7a295183bf1f285b059b82cc57fe635c9b24;hb=e3217cb5d83d1ae15f1795bef7c885740607689b;hp=336bf31c3d56ca17a9712de6074b411adfc490a1;hpb=04fdbaf85a26eafd9d5d1e15c3ee46ef360de509;p=perl%2Fmodules%2FTest-Leaner.git diff --git a/lib/Test/Leaner.pm b/lib/Test/Leaner.pm index 336bf31..1efe7a2 100644 --- a/lib/Test/Leaner.pm +++ b/lib/Test/Leaner.pm @@ -28,6 +28,12 @@ BEGIN { my $TAP_STREAM = *STDOUT; my $DIAG_STREAM = *STDERR; +for ($TAP_STREAM, $DIAG_STREAM) { + my $fh = select $_; + $|++; + select $fh; +} + my ($plan, $test, $failed, $no_diag, $done_testing); sub NO_PLAN () { -1 } @@ -96,12 +102,6 @@ sub plan { croak("plan() doesn't understand @args"); } - { - my $fh = select $TAP_STREAM; - $|++; - select $fh; - } - if (defined $plan_str) { local $\; print $TAP_STREAM "$plan_str\n"; @@ -143,6 +143,7 @@ sub import { push @imports, @{ $_[$i+1] }; $splice = 2; } elsif ($item eq 'no_diag') { + lock $plan if THREADSAFE; $no_diag = 1; $splice = 1; }