title: How to call a Mojolicious controller method after failing on template
body: <p>I have a Mojolicious problem that I suspect has an easy solution, but I can't swim through all of its code.</p>
  
  <pre><code>$r-&gt;get(
      '/:controller/:action',
      sub {
          my $c = shift;
          $c-&gt;render_maybe &amp;&amp; return;
  
         # No template. Either call controller-&gt;action() or dispatch as POST
      }
  );
  $r-&gt;post('/:controller/:action');
  </code></pre>
  
  <p>As you can see, I have two routes that use the same URL, one for GET and one for POST. The POST is straightforward. It renders after finding the controller and action method and isn't concerned with a template. I have the GET method working where a template exists, ignoring the controller, by using a callback with render_maybe(). My issue is, if there isn't a template, I want to go ahead and run the controller's method.</p>
  
  <p>One solution would be to simply identify my controller and call the action. Since I'm using placeholders in my route, I can't simply hard code this. So, is there a Mojolicious way of getting my controller class, or actual code that will get the class and call the method? I have both controller and action defined in stash, so this really shouldn't be a big deal. Mojo knows how to do this internally.</p>
  
  <p>Another option would be to convert this to a POST method and run it as normal. I don't know if it's best to either come up with the URL, or find the defined POST route, or just convert my GET to a POST. I'm not sure how to accomplish any of these.</p>
  
  <p>Thanks.</p>