stas 2004/06/30 19:01:22
Modified: t/protocol/TestProtocol echo_bbs.pm echo_bbs2.pm echo_block.pm echo_filter.pm Log: it seems that 'last if $rc == APR::EOF' is enough to break the loop Revision Changes Path 1.5 +1 -7 modperl-2.0/t/protocol/TestProtocol/echo_bbs.pm Index: echo_bbs.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/protocol/TestProtocol/echo_bbs.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- echo_bbs.pm 30 Jun 2004 23:27:05 -0000 1.4 +++ echo_bbs.pm 1 Jul 2004 02:01:21 -0000 1.5 @@ -29,14 +29,8 @@ while (1) { my $rc = $c->input_filters->get_brigade($bb_in, Apache::MODE_GETLINE); - if ($rc != APR::SUCCESS && $rc != APR::EOF) { - my $error = APR::Error::strerror($rc); - warn __PACKAGE__ . ": get_brigade: $error\n"; - last; - } - - last if $bb_in->is_empty; last if $rc == APR::EOF; + die APR::Error::strerror($rc) unless $rc == APR::SUCCESS; while (!$bb_in->is_empty) { my $bucket = $bb_in->first; 1.5 +1 -5 modperl-2.0/t/protocol/TestProtocol/echo_bbs2.pm Index: echo_bbs2.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/protocol/TestProtocol/echo_bbs2.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- echo_bbs2.pm 30 Jun 2004 23:27:05 -0000 1.4 +++ echo_bbs2.pm 1 Jul 2004 02:01:21 -0000 1.5 @@ -30,12 +30,8 @@ my $bb_in = APR::Brigade->new($c->pool, $c->bucket_alloc); my $rc = $c->input_filters->get_brigade($bb_in, Apache::MODE_GETLINE); - if ($rc != APR::SUCCESS && $rc != APR::EOF) { - my $error = APR::Error::strerror($rc); - warn __PACKAGE__ . ": get_brigade: $error\n"; - last; - } last if $rc == APR::EOF; + die APR::Error::strerror($rc) unless $rc == APR::SUCCESS; next unless $bb_in->flatten(my $data); $bb->cleanup; 1.7 +1 -1 modperl-2.0/t/protocol/TestProtocol/echo_block.pm Index: echo_block.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/protocol/TestProtocol/echo_block.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -u -u -r1.6 -r1.7 --- echo_block.pm 9 Jun 2004 14:46:22 -0000 1.6 +++ echo_block.pm 1 Jul 2004 02:01:21 -0000 1.7 @@ -12,7 +12,7 @@ use APR::Socket (); use Apache::Const -compile => 'OK'; -use APR::Const -compile => qw(SO_NONBLOCK TIMEUP EOF); +use APR::Const -compile => qw(SO_NONBLOCK); use constant BUFF_LEN => 1024; 1.17 +2 -9 modperl-2.0/t/protocol/TestProtocol/echo_filter.pm Index: echo_filter.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/protocol/TestProtocol/echo_filter.pm,v retrieving revision 1.16 retrieving revision 1.17 diff -u -u -r1.16 -r1.17 --- echo_filter.pm 30 Jun 2004 23:27:05 -0000 1.16 +++ echo_filter.pm 1 Jul 2004 02:01:21 -0000 1.17 @@ -39,13 +39,8 @@ while (1) { my $rc = $c->input_filters->get_brigade($bb, Apache::MODE_GETLINE); - if ($rc != APR::SUCCESS && $rc != APR::EOF) { - my $error = APR::Error::strerror($rc); - warn __PACKAGE__ . ": get_brigade: $error\n"; - last; - } - - last if $bb->is_empty; + last if $rc == APR::EOF; + die APR::Error::strerror($rc) unless $rc == APR::SUCCESS; # fflush is the equivalent of the following 3 lines of code: # @@ -53,8 +48,6 @@ # $bb->insert_tail($b); # $c->output_filters->pass_brigade($bb); $c->output_filters->fflush($bb); - - last if $rc == APR::EOF; } $bb->destroy;