"Fossies" - the Fresh Open Source Software Archive

Member "mod_perl-2.0.11/t/response/TestApache/read3.pm" (5 Oct 2019, 1006 Bytes) of package /linux/www/apache_httpd_modules/mod_perl-2.0.11.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "read3.pm": 2.0.8_vs_2.0.9.

    1 # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*-
    2 package TestApache::read3;
    3 
    4 # extra tests in addition to TestApache::read
    5 
    6 use strict;
    7 use warnings FATAL => 'all';
    8 
    9 use Apache2::RequestRec ();
   10 use Apache2::RequestIO ();
   11 use APR::Table ();
   12 
   13 use Apache::Test;
   14 use Apache::TestUtil;
   15 
   16 use Apache2::Const -compile => qw(OK);
   17 
   18 my $expected = "foobar"x2000;
   19 
   20 sub handler {
   21     my $r = shift;
   22 
   23     # test to read data up to end of file is signaled
   24     my $data = '';
   25     my $where = 0;
   26     my $len;
   27     do {
   28         $len = $r->read($data, 100, $where);
   29         $where += $len;
   30     } while ($len > 0);
   31 
   32     # only print the plan out after reading to avoid chances of a deadlock
   33     # see http://mail-archives.apache.org/mod_mbox/perl-dev/201408.mbox/%3C20140809104131.GA3670@estella.local.invalid%3E
   34     plan $r, tests => 1;
   35 
   36     ok t_cmp($data, $expected, "reading up to end of file");
   37 
   38     Apache2::Const::OK;
   39 }
   40 1;
   41