Stas Bekman wrote: [...]
I've further simplified the buffering by creating a new class:
package Apache::TestToStringRequest;
sub new { my($class, $r) = @_; die "\$r is required" unless $r; Apache::TestToString->start; return bless \$r, __PACKAGE__; }
sub DESTROY { my $self = shift; $$self->print(Apache::TestToString->finish); }
So now the test needs to only create the object, and its DESTROY will flush the data (not very intuitive though)
sub handler { my $r = shift;
# this buffers the ok's and will flush them out on sub's end my $x = Apache::TestToStringRequest->new($r);
plan tests => $tests;
read_test(); threads->new(\&read_test)->join() for 1..$threads; read_test();
Apache2::Const::OK; }
should probably use $r->pool->cleanup_register(sub { untie *STDOUT }); instead, in which case no object will be needed. Though it won't work under mp1. What should go with?
Nuh, cleanup_register is too late, the connection has been already closed and the data is lost:
package Apache::TestToStringRequest;
sub new {
my($class, $r) = @_;
die '$r is required' unless $r;
Apache::TestToString->start; # XXX: only mp2
require Apache2::RequestIO;
require Apache2::RequestRec; # $r->pool
require APR::Pool;
$r->pool->cleanup_register(\&Apache::TestToString::finish);
}So for now sticking with a fake object (the top of this email). If you have better ideas please suggest.
-- __________________________________________________________________ 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]
