Java Mailing List Archive

http://www.apache-httpd.com/

Home » modperl.perl »

Re: Problem getting started

Adam Prime

2008-07-12

Replies: Find Java Web Hosting

Author LoginPost Reply
Please include the list on replies, so the archives are complete.

Quoting "John M. Dlugosz" <l3hc4oo02@(protected)>:

> Adam Prime adam.prime-at-utoronto.ca |mod_perl mailing list| wrote:
>> For the Apache2::Request problem you're running:
>>
>>   use Apache2::Request;
>>   $req = Apache2::Request->new($r);
>>   @foo = $req->param("foo");
>>   $bar = $req->args("bar");
>>
>> and getting a segfault on new?
>
> If I reduce it down to the first two lines only, I get the segfault.
> If I reduce it to the first line only, I don't.
>
>
>> Are you running this as a handler, or through one of the CGI  
>> emulation layers (ModPerl::PerlRun, or ModPerl::Registry for  
>> example). you do
>
> ModPerl::Registry.
>
> In my apache2.conf file:
>
>  PerlModule ModPerl::Registry
>
>  <Location "/modperl/">
>     SetHandler perl-script
>     PerlHandler ModPerl::Registry
>     Options +ExecCGI
>     PerlSendHeader On
>     Allow from all
>  </Location>
>
> Hmm, is there a way to find out whether these settings are applying to
> the directory I think it is? /modperl/ should be applied to each
> DocumentRoot, right?
>

correct.

>> also have
>>
>> my $r = shift;
>>
>> somewhere above that (and ideally use strict; as well) right?
>
> No, just what it shows in the example.

This is your problem. Apparently if you call Apache2::Request->new
with an undefined object, it segfaults.

i ran this:

use Apache2::Request;
my $req = Apache2::Request->new($r);
print qq[Content-type: text/html\n\n];
print q[hi];

through registry, and saw

[Sat Jul 12 22:58:58 2008] [notice] child pid 5703 exit signal
Segmentation fault (11)

If you change that to

use Apache2::Request;
my $r = shift;
my $req = Apache2::Request->new($r);
print qq[Content-type: text/html\n\n];
print q[hi];

it should work. Unfortunately, it looks like the documentation for
ModPerl::Registry is kind of lacking on perl.apache.org, but what is
there is at
http://perl.apache.org/docs/2.0/api/ModPerl/Registry.html

Adam




©2008 apache-httpd.com - Jax Systems, LLC, U.S.A.