Fixed! Was: Re: PerlOutputFilterHandler runs twice...?



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;
.



Relevant Pages

  • Re: OpenForm Filtering too much
    ... The filter text is built up in a text box in the form SearchBuilder as ... ShowResults is a form built on a table, ... The weird part is that for some searches, the NULLS that matter seem to be ... another tag field for with options roots, ...
    (microsoft.public.access.macros)
  • Re: Parsing XML and storing attributes in MySQL using Perl
    ... I am trying to store huge amounts of data from xml files and put them ... It would send the same attribute info to a tag handler. ... Each filter is specific, set by the ... Yours is a basic search but the intent is to ...
    (comp.lang.perl.misc)
  • Re: rcb - begin post this way??
    ... In another group someone suggested a tag like that and the ... next day all the posts had that tag, which made them easier to filter ... If they want to use Xnews, sylpheed-claws, ... they could install slrn and have a lot more free time to ...
    (rec.crafts.brewing)
  • Re: Form Filter... "Enter Parameter Value" ??
    ... I am new to creating form filters, and I was unaware of the "Tag" option ... > Hi Brook ... > Are you sure that each of your FilterX comboboxes has its Tag property set ... >>> the name of the corresponding field to filter. ...
    (microsoft.public.access.formscoding)
  • Mail Rules on Email Header
    ... I'm testing out some spam software called SpamCatcher by Aladdin Systems. ... Besides modifying the email subject with a tag of "" that's ... filter on this header in order to send these specific messages to a specific ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)