So we can use Apache::TestToString, but the tied buffer needs to be shared:
Index: Apache-Test/lib/Apache/Test.pm =================================================================== --- Apache-Test/lib/Apache/Test.pm (revision 161957) +++ Apache-Test/lib/Apache/Test.pm (working copy) @@ -506,8 +493,13 @@
package Apache::TestToString;
+use Config;
sub TIEHANDLE {
my $string = "";
+ if ($] >= 5.008 && $Config{useithreads} && $INC{'threads.pm'}) {
+ require threads::shared;
+ $string = &threads::shared::share(\$string);
+ }
bless \$string;
}
and then we can write things like:
sub handler {
my $r = shift;Apache::TestToString->start;
plan tests => $tests;
read_test();
threads->new(\&read_test)->join() for 1..$threads;
read_test();$r->print(Apache::TestToString->finish);
Apache2::Const::OK; }
Clumsy, but at least it almost works.
I just need to figure out why Test::Builder doesn't do proper sub-test counting :9(
Test output counter mismatch [test 32] ok 13 - tid: 0: pass 1: Test output counter mismatch [test 33] ok 14 - tid: 0: pass 2: Test output counter mismatch [test 34] ok 15 - tid: 0: pass 1: ...
even though threads.pm was loaded before Test::Builder.
-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
