Marcus Ramberg (marcusramberg) wrote,
Marcus Ramberg
marcusramberg

Dispatch by request method

I often find myself needing to make actions that should only be dispatched to by the POST method, or writing dispatch logic to distinguish between POST and GET in my various methods. It would be nice if the Catalyst dispatcher could handle this for me directly. However, we should probably support the whole HTTP spec, and adding those would pollute the attribute space pretty badly. Thus I suggest that we add a prefix, like do_POST or require_DELETE to the dispatch value. The other alternative is to add a method attribute, which would make the api look something like this

sub admin : Local Method('POST') {}

Obviously, it would have to match against specific methods first, then fall back on a generic handler without a specified method. Any other thoughts on the API?
Tags: catalyst
Subscribe

  • Angerwhale officially released

    Congrats to Jrockway on releasing Angerwhale. Angerwhale is a filesystem-based blog with integrated cryptography, built on the Catalyst framework.…

  • Hashing passwords on user creation.

    If you use Catalyst auth with hashed passwords, here's how to create the digest in your DBIx::Class user class automatically. sub store_column { my…

  • Couple of Catalyst powered sites.

    Even tho we haven't got the holy buzz of Rails, people seem to be putting up new Catalyst-powered sites all the time. I'll try to mention some as I…

  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 5 comments