Hello,
I am a newbie to this list, so please forgive me if this is not the
place where I should asking this question.
I am writing a filter module for MP2 that will parse its input for
certain embedded commands.
One of these commands should cause the filter to issue a SubRequest to
get the output of another file or cgi script on the server.
The output of the SubRequest will also be processed, and I will need to
have access to the headers it returned, I can then set cookies etc.
In MP1 I had big problems when it came to processing the output of a
SubRequest because there was no way of capturing the output.
In MP2 Progress has been somewhat slower since I am unfamiliar with the
documentation.
Before porting all my code from MP1 to MP2 I decided to write some test
scripts to check that I was able to use the functionality that I
require.
Here is my test setup
<Files ~ "\.html">
PerlOutputFilterHandler Apache::testfilter
</Files>
> package Apache::testfilter;
>
>
> use strict;
> use warnings;
>
>
> use Apache::Filter ();
> use Apache::SubRequest ();
> use Apache::RequestRec ();
> use APR::Table ();
>
>
> use Apache::Const -compile => qw(OK);
>
>
> use constant BUFF_LEN => 1024;
>
>
> sub handler {
> my $f = shift;
>
>
>
>
> unless ($f->ctx) {
> $f->r->headers_out->unset('Content-Length');
> $f->ctx(1);
>
>
>
>
>
>
> my $rr = $f->r->lookup_uri("subrequest.txt");
> #$rr->run;
>
>
> }
>
>
> #From the filter example on perl.apache.org */
> while ($f->read(my $buffer, BUFF_LEN)) {
> $buffer =~ s/[\r\n]//g;
> $f->print($buffer);
> }
>
>
> $f->print("\nEnd of Filter\n");
> return Apache::OK;
> }
> 1;
For some reason, the server segfaults when the above code is run (with
the $rr->run line present)
[Mon Aug 25 16:16:12 2003] [notice] Graceful restart requested, doing restart
apache2: Could not determine the server's fully qualified domain name, using
127.0.0.1 for ServerName
[Mon Aug 25 16:16:12 2003] [notice] Apache/2.0.47 (Debian GNU/Linux) mod_perl/1.99_09
Perl/v5.8.0 configured -- resuming normal operations
Then when I make a request...
[Mon Aug 25 16:16:16 2003] [notice] child pid 13250 exit signal Segmentation fault
(11)
I know I am doing something wrong because I have still not figured out a
way to obtain the output from the subrequest.
After a few hours of trying different things, I found that a subrequest
will work if it is in one of the handler modules eg PerlResponseHandler
I would like to thank anyone (in advance) for helping me solve this
problem.
--
Craig Shelley <[EMAIL PROTECTED]>
A "goto" in Perl falls into the category of hard things that should be
possible, not easy things that should be easy.
-- Larry Wall in <[EMAIL PROTECTED]>
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html