[Catalyst] Componentised actions.

Nilson Santos Figueiredo Junior acid06 at gmail.com
Fri Mar 30 04:46:48 GMT 2007


On 3/29/07, Oleg Pronin <syber.rus at gmail.com> wrote:
> I cannot forward to the list actions because they are not private actions
> (they have its own URLs). In docs 'forward' is for private actions.

If the docs state that, they're wrong. It's perfectly possible to
forward to public actions.

> For example you can create url-action which edits some objects and include
> it in many templates. This is not like
> ordinary template toolkit's include - this component can show itself, modify
> data, receive request params etc, like
> any web page. And this doesnt depend on whether this action is directly
> called from browser or included in some template.

You could have some thing like this:

  sub nice_page : Local {
    my ($self, $c) = @_;
    $c->forward('object1');
    $c->forward('object2');
  }

Then, inside nice_page.tt:

  [% INCLUDE object1.tt %]
  [% INCLUDE object2.tt %]

Should do exactly what you want. And, well, if it doesn't you can
always use Catalyst::Plugin::SubRequest.

-Nilson Santos F. Jr.



More information about the Catalyst mailing list