Fixed! Was: Re: PerlOutputFilterHandler runs twice...?
- From: Dodger <el.dodgero@xxxxxxxxx>
- Date: Sat, 9 Feb 2008 13:21:49 -0800 (PST)
Okay, I worked out how to do it!!! Yay!
First, if ctx (context) is not true, print the top tag and set context
true. That covers the top.
Second, for the bottom tag, check the 'seen_eos()' method. If THAT is
true, the filter isn't gonna run again, so you can print the bottom
tag. Worked like a charm it looks like.
Like so:
package Local::GCPage;
use strict;
use warnings;
use base qw(Apache2::Filter);
use Apache2::Const -compile => qw(OK);
sub handler : FilterRequestHandler {
my $f = shift;
unless ($f->ctx) {
# only ONCE, print the top before other things
$f->print('<!--#include virtual="/elements/top.shtml" -->');
$f->ctx(1);
}
while ($f->read(my $buffer, 1024)) {
$f->print($buffer);
}
if ($f->seen_eos) {
# after everything, print the bottom tag
$f->print('<!--#include virtual="/elements/bottom.shtml" --
');}
return Apache2::Const::OK;
}
1;
.
- References:
- PerlOutputFilterHandler runs twice...?
- From: Dodger
- Re: PerlOutputFilterHandler runs twice...?
- From: Dodger
- PerlOutputFilterHandler runs twice...?
- Prev by Date: Re: PerlOutputFilterHandler runs twice...?
- Next by Date: Net::DHCP::Packet - problems recv'ing broadcasted DHCP Offer
- Previous by thread: Re: PerlOutputFilterHandler runs twice...?
- Next by thread: Net::DHCP::Packet - problems recv'ing broadcasted DHCP Offer
- Index(es):
Relevant Pages
|
|