On Thu, Jul 05, 2001 at 04:03:00PM +0100, Paul Sharpe wrote:
> barries wrote:
> >
> > On Thu, Jul 05, 2001 at 03:21:12PM +0100, Paul Sharpe wrote:
> > > Here's my handler...
> > >
> > > package Foo::Test;
> > > use strict;
> > > use warnings;
> > > use Apache::Constants qw(:common HTTP_OK);
> > >
> > > sub handler {
> > > my $r = shift;
> > > my $uri = 'foo.html';
> > > $r->content_type('text/plain');
> > > $r->send_http_header;
> > > $r->lookup_uri($uri);
> >
> > Try: my $s = $r->lookup_uri($uri);
> >
> > > $r->print("lookup_uri($uri) status = ",$r->status,"\n");
> >
> > Try: $s->status
> >
> > > }
> > >
> > > 1;
>
> Still returns
>
> lookup_uri(foo.html) status = 200
The lookup succeeds whether or not the file exists (though it will fail
if the httpd.conf forbids access). This about the case of an
all-virtual set of URIs where your mod_perl handler is simulating
documents that don't exist. Results other than HTTP_OK will only occur
if the URI->filename translation fails for some reason.
In your case, I think you'd need to add
my $c = $s->status ;
$c = HTTP_NOT_FOUND if $c eq HTTP_OK && ! -e $s->filename ;
and report the value of $c (also need to import HTTP_NOT_FOUND).
HTH,
Barrie