perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc M. Adkins" <mma...@Doorways.org>
Subject RE: Handler attributes
Date Fri, 02 May 2003 01:57:03 GMT
> PerlRequire /path/to/startup.pl (where @INC is adjusted)
> PerlModule Site::Filter
> <Location /filter>
> 	    SetHandler          modperl
> 	    PerlOutputFilterHandler Site::Filter
> </Location>

That's what I was doing.  I kept getting error messages at Apache startup
saying that it couldn't find the module.  It showed me the @INC and it
wasn't what startup.pl was supposed to be setting.

Just tried it again:

  [Thu May 01 18:15:17 2003] [error]
	Can't locate Site/Wrapper.pm in @INC
	(@INC contains: C:/Perl/lib C:/Perl/site/lib . C:/Apache2/
	 C:/Apache2/lib/perl) at (eval 1) line 3.

But using the '+' notation works jus' fine.  Weird.

> Actually you don't need 'SetHandler modperl' if you don't run a
> response phase in mod_perl.

Yeah, I've been discovering that.

-------------------------------------------------------

What's weird now is that I'm not sure that the output filter is getting
invoked properly on 'default' pages.  That is to say, just using an output
filter to wrap formatting around a plain 'ole HTML page as opposed to
wrapping the output of a PerlResponseHandler.

To be more specific...if I configure:

  AddHandler                modperl html
  PerlResponseHandler       Site::Dummy

  PerlOutputFilterHandler   +Site::Wrapper

where Site::Dummy simply reads the target HTML file from disk and sends it
out via the request object, everything works fine.  But if I just use:

  PerlOutputFilterHandler   +Site::Wrapper

by itself the pages don't 'complete.'  The tail end of each page is for some
reason lost.  It's like I'm hitting the EOS marker before processing all of
the data from the source page, but I know that I'm not.

The core code from my output filter is in fact:

    # We only process HTML documents:
    return Apache::DECLINED
        unless $filter->r->content_type =~ m|text/html|i;

    while ($filter->read(my $buffer, 1024)) {
        # process $buffer appropriately
    }

    # Don't do anything until the page is finished:
    return Apache::OK
        unless $filter->seen_eos;

    # At this point the page is finished and I send all data
    #   out via the $filter object

I've been wondering if there was some Apache::Filter::flush() call I was
missing, but it _works_ when I use the Site::Dummy PerlResponseHandler.  It
only misses the end when I just let the page be fed in _without_ the
response handler.

mma


Mime
View raw message