On Fri Oct 14 09:14:38 2011, mark@summersault.com wrote:
Show quoted text>
> > Right now, CGI::Application::Dispatch will return a 404 error...
> >
> >> When the path does not match anything in the "DISPATCH TABLE", or
> >> module could not be found in @INC, or run mode did not exist.
> >
> > My dispatch table does method matching and I'd prefer it if I could
> > return a 405 error the HTTP client attempts to use a PUT on one of my
> > resources.
> >
> > I know that I could create a 'method_not_supported' runmode, but it
> > would be nice if this module could handle that explicitly for me.
>
> Thanks for the feedback, Dan.
>
> How would you like CGI::App::Dispatch to handle this better for you?
> How would you expect the dispatcher to decide when to return a 404 vs
a 405?
Show quoted text>
> Mark
I did some further searching and it seems that
CGI::Application::Plugin::REST might be what I'm *really* looking for.
However, perhaps something like:
':app/news[delete]' => { rm => 'delete_news' },
':app/news[post]' => { rm => 'add_news' },
':app/news[get]' => { rm => 'news' },
':app/news[put]' => { error => 405 },
i.e. it would be for the developer to explicitly mark methods as
unsupported.
Alternatively, the mere presence of a method filter for a resource, such as:
':app/resource[get]' => { rm => 'resource' },
would tell CGI::App::Dispatch that all *other* methods should return a 405.
If you're interested, I could look into writing a patch