Hi Barry,

Barry Hoggard <[EMAIL PROTECTED]> wrote:
Is there a good way to return a 404 error from the AUTOLOAD run mode,
or inside a normal run mode (such as when a bad parameter value comes
in)?  I know I can return a not found page programmatically that has
a 200 status, but I want a real 404 error for some applications.

I use something like this:

sub not_found {
   my $self = shift;
   $self->header_props(-status => '404 (pretending to be) Not Found');
   return '';
}

so I can return $self->not_found() from other run-modes conveniently.

To the browser, its pretty much indistinguishable from a "real" apache 404. The "(pretending to be)" string only shows up in the HTTP status headers and of course you can make it more authentic-looking by leaving that bit out.

Also you can customize the "stock" apache 404 error page by returning something other than an empty string. I'd recommend: "We're sorry. Your bank account database records all appear to have been deleted. If you feel you've reached this message in error..."

Since its not a real apache 404, if you want these to be logged in the error log, you might want to print STDERR "Something" there yourself.

hth,

-dave

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to