You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Ray L. Chen" <rl...@clover.csie.ntu.edu.tw> on 2000/03/26 10:07:14 UTC

Can modperl intercept dynamic page?

Hi,

I have a question about how to intercept dynamic pages in modperl?

For example, in eagle book, there's a navigation bar sample that is
added to every "static" page by modperl. However, if  I want to add this
navigation bar to even "dynamic" page, how should I do?

I'd once considered the Apache::Forward approach, however, it doesn't
work if you use $r->print instead of print.

ex:
in .conf file:

<Location /hello>
  SetHandler perl-script
  PerlHandler Apache::MyFilter Apache::Hello
</Location>

in Apache::Hello

[1]sub handler {
[2]    my $r = shift;
[3]    $r->content_type('text/plain');
[4]    $r->send_http_header;
[5]    return OK if $r->header_only;
[6]    my $host = $r->get_remote_host;
[7]    print(<<END);

This approach works, MyFilter will have a chance to modified the content
of the output from Hello.pm, however, if you change the line[7] to
"$r->print(<<END)", the result shows that MyFilter have no use at all.

Does anyone know how to solve this problem? Thanks a lot!

Ray.


Re: Can modperl intercept dynamic page?

Posted by "G.W. Haywood" <ge...@jubileegroup.co.uk>.
Hi there,

On Sun, 26 Mar 2000, Ray L. Chen wrote:

> For example, in eagle book, there's a navigation bar sample that is
> added to every "static" page by modperl. However, if  I want to add this
> navigation bar to even "dynamic" page, how should I do?

Look for "Chaining content handlers" in the Eagle book.

73,
Ged.