[cgiapp] Cannot return custom ErrorDocument with CGI::Application::Dispatch

Michael Lackhoff lackhoff at zbmed.uni-koeln.de
Fri Mar 14 08:14:21 EDT 2008


Hello,

I am trying to produce a nice error page when something is going wrong 
but whatever I try I only get this:

  Not Found
  The requested URL /demo/home/not_a_runmode was not found on this
  server.
  Additionally, a 404 Not Found error was encountered while trying to  
  use an ErrorDocument to handle the request

First I tried it with the error_document parameter in dispatch_args:
error_document => '"Oopss... HTTP Error #%s', # from the docs

Then I tried it the Apache way in httpd.conf:
ErrorDocument 404 /myerror404.html

As I said, the result is always the same, namely the text quoted above, 
no custom error page/string.

Just for reference, here is the relevant part of my httpd.conf:
<Location /demo>
    SetHandler perl-script
    PerlHandler Demo::CAP::Dispatch
    ErrorDocument 404 /myerror404.html
</Location>

And here is the complete Demo::CAP::Dispatch:

package Demo::CAP::Dispatch;

use base 'CGI::Application::Dispatch';

sub dispatch_args {
    return {
        prefix  => 'Demo::CAP',
        error_document => '"Oopss... HTTP Error #%s',
        args_to_new => {
            PARAMS => {
                cssloc   => '/demoplain',
                jsloc    => '/demoplain',
            },
        },
        table   => [
            ''                => { app => 'home', rm => 'start' },
            ':app/:rm'        => { },
            ':app/:rm/:nr'    => { },
        ],
    };
}

1;

Existing runmodes do work (at least with perl-script as above, not with 
'SetHandler modperl' but that is another question). It is just the 
error message for missing runmodes I am after here.

Any ideas what is going wrong? 
A working example using CAP::Dispatch with mod_perl would be great, 
too. I could feel my way from there.

Thanks
-Michael



More information about the cgiapp mailing list