Pushing OutputHandler using PerlFixupHandler

[prev] [thread] [next] [Date index for 2005/03/21]

From: Thomas Schindl
Subject: Pushing OutputHandler using PerlFixupHandler
Date: 12:08 on 21 Mar 2005
Hi,

am I too stupid or does anybody see the problem with the code above doesn't
push an output-filter? When uncommenting PerlOutputFilterHandler line the
filter is invoked but I cannot push them dynamically. Why?

-----------------8<-----------------
<Files *\.xml >
    PerlSetVar AxDebugLevel 9
    PerlFixupHandler Beso::PushOutFilterHandler
    #PerlOutputFilterHandler Beso::OutFilterHandler
    PerlSetVar AxDebugLevel 10
</Files>
-----------------8<-----------------

-----------------8<-----------------
package Beso::PushOutFilterHandler;

use Apache::RequestRec;
use Apache::Const qw(:common);
use Beso::OutFilterHandler;

sub handler {
    my $r = shift;
    $r->push_handlers( 
          PerlOutputFilterHandler => 
          \&Beso::OutFilterHandler::handler
        );

    return Apache::OK;
}

1;
-----------------8<-----------------

-----------------8<-----------------
package Beso::OutFilterHandler;

use strict;
use warnings;

use Apache::Filter ();
use Apache::RequestRec ();
use APR::Table ();

use Apache::Const -compile => qw(OK);

use constant BUFF_LEN => 1024;

sub handler {
    my $f = shift;

    print STDERR "Filter is invoked\n";
    
    unless ($f->ctx) {
        $f->r->headers_out->unset('Content-Length');
        $f->ctx(1);
    }

    while ($f->read(my $buffer, BUFF_LEN)) {
        $buffer =~ s/[\r\n]//g;
        $f->print($buffer);
    }

    return Apache::OK;
}

1;
-----------------8<-----------------

        -- 
        "Happy ProMail" bis 24. März: http://www.gmx.net/de/go/promail
Zum 6. Geburtstag gibt's GMX ProMail jetzt 66 Tage kostenlos!

(message missing)

Pushing OutputHandler using PerlFixupHandler
Thomas Schindl 12:08 on 21 Mar 2005

Re: Pushing OutputHandler using PerlFixupHandler
Geoffrey Young 12:47 on 21 Mar 2005

Generated at 15:10 on 27 Mar 2005 by mariachi v0.52