[Catalyst] Getting relative path to methods

J. Shirley jshirley at gmail.com
Tue Dec 15 19:13:00 GMT 2009


On Tue, Dec 15, 2009 at 10:51 AM, Derek Wueppelmann <dwueppel at gmail.com>wro=
te:

> Hello all,
>
> I'm currently using FormBuilder to generate some forms to be used in my
> Catalyst Application. However FormBuilder wants to have the same method
> handle the submit as well as the display. For certain reasons this isn't
> what I want. So I'm trying to set the action of the form to the correct
> path. However FormBuilder only wants to take a path that is rooted for
> it's action argument, for example:
>
> $form =3D $self->formbuilder();
> # Works:
> $form->action('/path/to/method');
>
> # Doesn't work:
> $form->action('path/to/method');
> # Still doesn't work:
> $form->action("http://example.com/path/to/method");
>
> What I really want to be able to use is something like:
>
> $c->uri_for($self->action_for('method_name'), ...);
>
> However this returns a url complete with the HTTP. Is it possible to get
> something similar that provides just the path (/path/to/method)? The
> reason I want to do it this way is that I have some methods that are
> submitting to URLS that contain captures.
>
>
$c->uri_for returns a URI object.  If you look at the pod there, you'll see
the ->path method which returns exactly what you want.

-J
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20091215/1c0cb=
aca/attachment.htm


More information about the Catalyst mailing list