[Catalyst] uri_for and Chained actions
Oleg Pronin
syber.rus at gmail.com
Wed Oct 10 23:51:31 GMT 2007
If your project is heavy loaded then i think the best way is to write:
<form action=3D"/myapp/[%object.id%]/update">
or (easy to change):
<form action=3D"[%object.update_url%]">
in Object:
sub update_url {'/myapp/'.shift->id.'/update}
because Catalyst.uri_for() still takes to much CPU to call it a hundred
times per page.
2007/10/10, C=E9dric Bouvier <cbouvi at free.fr>:
>
> Hello Catalysters,
>
> I just started playing with Chained Actions, and so far I have a setup
> like this:
>
> /myapp/*
> /myapp/*/update
> /myapp/*/update_do
>
> 'update' and 'update_do' being implemented in MyApp::C::Foo::update and
> MyApp::C::Foo::update_do, respectively.
>
> Now, in the <form> that gets displayed when calling
> /myapp/foo/42/update, I'd like the "action" attribute to point to
> /myapp/foo/42/update_do. Unfortunately, if I write:
>
> <form action=3D"[% Catalyst.uri_for('update_do') %]>
>
> I end up with the URI to /myapp/foo/update_do. I could use
> $c->req->uri and use it as a base for the relative URL 'update_do', but
> please someone tell me that there is a better way?
>
> --
> C =E9 d r i c B o u v i e r
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFHDK2cV+dbgD38PGgRApCxAKDCiccWTZOPxTFUaneZfyTHjoW/5wCgw2BM
> tcwFfQ2guOl7HUroUMNjSk0=3D
> =3DGziv
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20071011/afe34=
8cf/attachment-0003.htm
More information about the Catalyst
mailing list