perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/todo api.txt
Date Thu, 08 Nov 2001 03:19:48 GMT
dougm       01/11/07 19:19:48

  Modified:    lib/Apache compat.pm
               todo     api.txt
  Added:       t/modperl readline.t
               t/response/TestModperl readline.pm
  Log:
  add READLINE compat stub and test
  
  Revision  Changes    Path
  1.23      +11 -0     modperl-2.0/lib/Apache/compat.pm
  
  Index: compat.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- compat.pm	2001/10/09 05:42:49	1.22
  +++ compat.pm	2001/11/08 03:19:47	1.23
  @@ -215,6 +215,17 @@
       return \$data;
   }
   
  +#XXX: would like to have a proper implementation
  +#that reads line-by-line as defined by $/
  +#the best way will probably be to use perlio in 5.8.0
  +#anything else would be more effort that it is worth
  +sub READLINE {
  +    my $r = shift;
  +    my $line;
  +    $r->read($line, $r->headers_in->get('Content-length'));
  +    $line ? $line : undef;
  +}
  +
   use constant IOBUFSIZE => 8192;
   
   #XXX: howto convert PerlIO to apr_file_t
  
  
  
  1.1                  modperl-2.0/t/modperl/readline.t
  
  Index: readline.t
  ===================================================================
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestRequest;
  use Apache::TestUtil;
  
  plan tests => 2, \&have_lwp;
  
  my $location = "/TestModperl::readline";
  
  my $expect = join "\n", map { $_ x 24 } 'a'..'e';
  
  my $str = POST_BODY $location, content => $expect;
  
  ok $str;
  
  ok t_cmp($expect, $str, 'readline');
  
  
  
  
  1.1                  modperl-2.0/t/response/TestModperl/readline.pm
  
  Index: readline.pm
  ===================================================================
  package TestModperl::readline;
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::compat (); #XXX
  
  sub handler {
      my $r = shift;
  
      tie *STDIN, $r unless tied *STDIN;
  
      while (defined(my $line = <STDIN>)) {
          $r->puts($line);
      }
  
      Apache::OK;
  }
  
  1;
  
  
  
  1.15      +2 -1      modperl-2.0/todo/api.txt
  
  Index: api.txt
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/todo/api.txt,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- api.txt	2001/11/07 04:03:07	1.14
  +++ api.txt	2001/11/08 03:19:48	1.15
  @@ -3,7 +3,8 @@
   ------------------------------------------
   
   tied filehandle interface:
  - -CLOSE, READLINE
  + -CLOSE, OPEN, BINMODE, EOF, TELL, SEEK, FILENO
  + -READLINE - proper implementation (see comment in Apache::compat)
   
   $r->finfo:
   need apr_finfo_t <-> struct stat conversion (might already be there,
  
  
  

Mime
View raw message