Dave Rolsky <[EMAIL PROTECTED]> writes:
> If you call Apache::Request->instance with an undefined value, it dies
> when it tries to call pnotes() on that argument.
>
> It seems to me that it should simply return a false value if given
> undef. This can happen if you have a piece of code like this:
>
> my $r = Apache::Request->instance(Apache->request);
>
> which may be called during server startup or during a request.
Would something like this be ok?
sub instance {
my ($class, $r) = @_;
return undef unless defined $r;
if (my $apreq = $r->pnotes('apreq')) {
return $apreq;
}
my $new_req = $class->new($r, @_);
$r->pnotes('apreq', $new_req);
return $new_req;
}
--
Joe Schaefer
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html