Greetings

I'm trying to create a mod_perl input filter, but getting an error as below. I've successfully created an output filter.

Here's the apache config

Perlrequire /opt/code/scripts/apache2-perl-startup.pl ... PerlOutputFilterHandler ZCRM::OFilter::output PerlInputFilterHandler ZCRM::OFilter::input

And here's the perl code (output filter works fine, but the input filter results in the error below)

package ZCRM::OFilter; use strict; use warnings; use Apache2::Filter (); use Apache2::RequestRec (); use Apache2::Const -compile => qw(OK DECLINED MODE_READBYTES); use APR::Const -compile => qw(SUCCESS BLOCK_READ); use Apache2::Connection (); use constant IOBUFSIZE => 8192; use strict; sub output { my $f = shift; my $r = $f->r; while ( $f->read( my $buffer, 1024 ) ) { # do work on $buffer... $f->print($buffer); } return Apache2::Const::OK; } sub input { my $r = shift; my $bb = APR::Brigade->new( $r->pool, $r->connection->bucket_alloc + ); # <--- Line XX - ERROR here my $data = ''; my $seen_eos = 0; do { $r->input_filters->get_brigade( $bb, Apache2::Const::MODE_READ +BYTES, APR::Const::BLOCK_READ, IOBUFSIZE ); for ( my $b = $bb->first ; $b ; $b = $bb->next($b) ) { if ( $b->is_eos ) { $seen_eos++; last; } if ( $b->read( my $buf ) ) { $data .= $buf; } $b->remove; # optimization to reuse memory } } while ( !$seen_eos ); $bb->destroy; return $data; } 1;

And the error:

...[perl:error] [pid 19117] [client 1.2.3.4:56504] Can't locate object + method "pool" via package "Apache2::Filter" at /opt/code/ZCRM/OFilte +r.pm line xx.\n, referer...

I'd appreciate any pointers or assistance
Thanks

In reply to mod_perl input filter error by henzen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.