henzen has asked for the wisdom of the Perl Monks concerning the following question:
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...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: mod_perl input filter error ( Can't locate object method "pool" via package "Apache2::Filter" )
by Anonymous Monk on Jun 19, 2016 at 23:12 UTC | |
by henzen (Acolyte) on Jun 19, 2016 at 23:27 UTC | |
by Anonymous Monk on Jun 19, 2016 at 23:47 UTC | |
by henzen (Acolyte) on Jun 20, 2016 at 09:39 UTC | |
|
Re: mod_perl input filter error
by henzen (Acolyte) on Jun 20, 2016 at 09:29 UTC | |
by Anonymous Monk on Jun 20, 2016 at 10:04 UTC | |
by henzen (Acolyte) on Jun 20, 2016 at 10:20 UTC | |
by Anonymous Monk on Jun 20, 2016 at 17:55 UTC |