stas 2004/06/04 02:35:37
Modified: t/conf modperl_extra.pl Log: various polish Revision Changes Path 1.51 +22 -13 modperl-2.0/t/conf/modperl_extra.pl Index: modperl_extra.pl =================================================================== RCS file: /home/cvs/modperl-2.0/t/conf/modperl_extra.pl,v retrieving revision 1.50 retrieving revision 1.51 diff -u -u -r1.50 -r1.51 --- modperl_extra.pl 31 May 2004 05:50:42 -0000 1.50 +++ modperl_extra.pl 4 Jun 2004 09:35:37 -0000 1.51 @@ -1,3 +1,6 @@ +use strict; +use warnings FATAL => 'all'; + use Socket (); #test DynaLoader vs. XSLoader workaround for 5.6.x use IO::File (); use File::Spec::Functions qw(canonpath catdir); @@ -119,26 +122,28 @@ Apache::OK; } -use constant IOBUFSIZE => 8192; +use APR::Brigade (); +use APR::Bucket (); use Apache::Const -compile => qw(MODE_READBYTES); use APR::Const -compile => qw(SUCCESS BLOCK_READ); +use constant IOBUFSIZE => 8192; + # to enable debug start with: (or simply run with -trace=debug) # t/TEST -trace=debug -start sub ModPerl::Test::read_post { my $r = shift; my $debug = shift || 0; - my @data = (); - my $seen_eos = 0; - my $filters = $r->input_filters(); my $ba = $r->connection->bucket_alloc; my $bb = APR::Brigade->new($r->pool, $ba); + my $data = ''; + my $seen_eos = 0; my $count = 0; do { - my $rv = $filters->get_brigade($bb, + my $rv = $r->input_filters->get_brigade($bb, Apache::MODE_READBYTES, APR::BLOCK_READ, IOBUFSIZE); if ($rv != APR::SUCCESS) { return $rv; @@ -161,14 +166,14 @@ my $buf = $b->read; warn "read_post: DATA bucket: [$buf]\n" if $debug; - push @data, $buf; + $data .= $buf if length $buf; } - $bb->destroy; - } while (!$seen_eos); - return join '', @data; + $bb->destroy; + + return $data; } sub ModPerl::Test::add_config { @@ -195,6 +200,9 @@ package ModPerl::TestTiePerlSection; +use strict; +use warnings FATAL => 'all'; + # the following is needed for the tied %Location test in <Perl> # sections. Unfortunately it can't be defined in the section itself # due to the bug in perl: @@ -212,6 +220,9 @@ package ModPerl::TestFilterDebug; +use strict; +use warnings FATAL => 'all'; + use base qw(Apache::Filter); use APR::Brigade (); use APR::Bucket (); @@ -262,9 +273,7 @@ my @data; for (my $b = $bb->first; $b; $b = $bb->next($b)) { - my $bdata = $b->read; - $bdata = '' unless defined $bdata; - push @data, $b->type->name, $bdata; + push @data, $b->type->name, $b->read; } # send the sniffed info to STDERR so not to interfere with normal @@ -328,8 +337,8 @@ # need, so some leaks can be hard to see, unless many tests (like a # hundred) were run. -use warnings; use strict; +use warnings FATAL => 'all'; # XXX: as of 5.8.4 when spawning ithreads we get an annoying # Attempt to free unreferenced scalar ... perlbug #24660