0

I just have one filter in my location tag of httpd.conf:

<Location /testproj/A>
SetHandler modperl
PerlInputFilterHandler MyApache2::Test
</Location>

Test is an PerlInputFilterHandler.

If I've following code in this filter:

package MyApache2::Test10;

use strict;
use Apache2::Const qw(OK);
use Apache2::Filter ();
use Apache2::RequestRec ();
use Apache2::RequestIO ();

sub handler {
my $f = shift; 

#my $buf = '';
#while($f->read(my $tempbuf, 1024)) {
#  $buf = $tempbuf;
#}

my $r = $f->r; 
$r->content_type("text/html\n\n"); 
$r->print("welcome!!!"); 

return OK;
}
1;

It generates response - in other words, it sends "welcome!!!" to browser.

However if I've following code (enables commented code):

package MyApache2::Test10;

use strict;
use Apache2::Const qw(OK);
use Apache2::Filter ();
use Apache2::RequestRec ();
use Apache2::RequestIO ();

sub handler {
my $f = shift; 

my $buf = '';
while($f->read(my $tempbuf, 1024)) {
  $buf = $tempbuf;
}

my $r = $f->r; 
$r->content_type("text/html\n\n"); 
$r->print("welcome!!!"); 

return OK;
}

1;

This doesn't work. The "welcome!!!" doesn't go to the browser - '404' does.

Can you suggest something here?

Thanks very much!

keeping_it_simple
  • 439
  • 1
  • 11
  • 31
  • Is it that you have PerlInputFilterHandler MyApache2::Test in the location stanza but your package is actually package MyApache2::Test10; ? – Martin Redmond Jun 22 '11 at 13:25

1 Answers1

0

You are omitting use warnings; from your code -- put that in and you will get more information about failing code in your error log. Clearly something about reading the input buffer is not working.

Ether
  • 53,118
  • 13
  • 86
  • 159