note
clinton
<p>Ah, yes. That's a failure of assumption by the doc authors :), and really [mod://Apache2::Request] should throw a proper error message instead of segfaulting in that situation. I'd raise a bug against that.</p>
<p>The reason I say assumption is that, for mod_perl programmers, <c>$r</c> is The One True Way of communicating with mod_perl, and so they have assumed that you know how to get hold of it. For somebody who is new to mod_perl, this is obviously not the case.</p>
<p>From the emails on the mod_perl mailing list, I assume that you have now sorted the issue out, but for clarification here, to get <c>$r</c>, which is an [http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html|Apache2::RequestRec] object, you would do the following:</p>
<ul>
<li><p>in [http://perl.apache.org/docs/2.0/api/ModPerl/Registry.html|ModPerl::Registry]:</p>
<code>
my $r = Apache2::RequestUtil->request;
</code>
</li>
<li><p>in a [http://perl.apache.org/docs/2.0/user/intro/start_fast.html#Handler_Modules|mod_perl handler]:</p>
<code>
use Apache2::RequestRec ();
sub handler {
my $r = shift;
...
}
</code>
</li>
</ul>
<p>mod_perl 1 had a lot of good docs, a lot of which were written by Stas Bekman while Ticketmaster paid him to work on mod_perl. mod_perl 2 has a lot of good code, but the docs have been written by people who are intimately familiar with the internals. So everything is there, but not as clearly laid out as it could be. Also, everybody has full time jobs... you know how it goes.</p>
<p>However, they are very receptive to doc (and other) patches, so if you see ways to improve what we have already, feel encouraged to send patches through - they will be warmly welcomed.</p>
<p>Clint</p>
697161
697405