I posted a more specific question earlier but I'll ask this more general question, hope this is OK…

How do I debug Catalyst when a GET request to a URL works but a POST request to a URL fails?

I've got debugging on and I can see my URL, or action, or route or whatever we should call it, loading like this:

[debug] Loaded Private actions: [snip] | Private | Class | Method | /user/update | MyApp::Controller::User | update [snip]

Then I can also see this:

[debug] Loaded Chained actions: [snip] | Path Spec | Private | /user/*/update | -> /user/chain (1) | | => /user/update (0) [snip]

Which makes sense, because the URL is myapp.com/user/<a given user's id>/update

But I still have my problem which is that when I do a GET to that URL, everything works. But when I do a POST to that URL, I get an error, actually a 404.

Inside the update method in the Controller, I have something like this:

if($c->req->method eq 'POST'){ ### update a database }

But the code appears to be failing before that ever runs, as soon as the POST request is made.

How do I debug this? In another type of application there would be a routing table specifying that a given URL accepts GETs or POSTs or both. But that's not how Catalyst works? How can I verify that a POST to that URL, and implicitly to that Controller and Action, is even allowed? And/or how can I debug what happens specifically when a POST is made and Catalyst throws an error?

More detail: the debug log shows just this:

.--------------------------------------------------------------------- +-------------------------------+-----------. | Action + | Time | +--------------------------------------------------------------------- +-------------------------------+-----------+ | user/<my user name>/update - start + | 0.024544s | | /auto + | 0.002635s | | -> /error_template + | 0.000193s | | /end + | 0.020821s |

so it performed the right Action, then 'auto' took over and it failed at that point?

TIA


In reply to Help me understand Catalyst routing, or do I mean Actions? by Cody Fendant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.