I’m very new to Catalyst and just starting building up a web app to learn some stuff.
One thing that I haven’t figured out is how to limit the requests to a given controller method to POST (for instance).
A concrete example would be, the request that will trigger the creation of an object in the Database. Since I want this app to be pretty strict regarding REST verbs, this should only be possible via POST.
I know that I can use
$c->method
to check the method used in the request, and return an error or something like that if I don’t find what I’m looking for, but I was hoping there was a… cleaner way.
Right now I have something like
sub create :Local :Args(0) {
...
}
Am I doomed to check the method inside the subroutine, and do this for every method there is?
Please do keep in mind that I’m extremely new to Catalyst, so this might be a stupid question.
Thanks for the help!
You can use the Catalyst::Controller::REST module.