You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Joachim Zobel <jz...@heute-morgen.de> on 2012/05/29 06:21:26 UTC

FilterHasInitHandler not working

Hi.

I have a rather straight test (see below) that tells me my
FilterInitHandler is not called. 

Am I missing something obvious or is this a bug?

Sincerely,
Joachim

.htaccess------------------------------------------------------
PerlModule TestInit

# The html file is arbitrary
<Files test6.html>
    SetHandler modperl
    PerlOutputFilterHandler TestInit 
</Files>
TestInit.pm----------------------------------------------------
use strict;
use warnings;

use Apache2::RequestRec;

use Apache2::Filter;

use APR::Brigade ( );
use APR::Bucket ( );
use APR::BucketType ( );

use Apache2::Log;  
use APR::Const -compile => ':common';
#use Apache2::Const;

package TestInit;

use URI;

use base qw(Apache2::Filter);

#
# Test if filter init is working
# 
sub init: FilterInitHandler {
  my($filter) = @_;

  $filter->r->log->debug("Init handler will be initialised.");
  $filter->ctx(1);
}

sub handler: FilterHasInitHandler(\&init)  {
  my($filter, $bb) = @_;

  $filter->r->log->debug("Init test handler called.");
  if ($filter->ctx) {
    return $filter->next->pass_brigade($bb);
  }
  $filter->r->log->error("Init test handler failed.");

  # Just says no success (which gives a 500)
  return 500;
}

1;





[Bug] FilterHasInitHandler not working

Posted by Joachim Zobel <jz...@heute-morgen.de>.
Hi.

It is a bug. The difference to the out_init_basic test that causes it is
that the response is provided by a static file.

Sincerely,
Joachim