[Catalyst] Componentised actions.

John Napiorkowski jjn1056 at yahoo.com
Fri Mar 30 21:07:48 GMT 2007



----- Original Message ----
From: Nilson Santos Figueiredo Junior <acid06 at gmail.com>
To: The elegant MVC web framework <catalyst at lists.rawmode.org>
Sent: Thursday, March 29, 2007 11:46:48 PM
Subject: Re: [Catalyst] Componentised actions.

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');
  }

I was always nervous about doing this because of my fear about Stash namespace collision.  To be honest I have a love hate relationship with the stash because I like the idea of  having a ready made messaging system but because it's hash based I feared the feeling I was making a very tightly coupled application.  You need to know the base stash key for your stuff, right?  And then it needs to be different for each action that you think might be in an action chain or forwarded to as in the example above.

Have you run into this problem, found ways around it or just don't feel paranoid about it?

--John

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.

_______________________________________________
List: Catalyst at lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/





 
____________________________________________________________________________________
No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 



More information about the Catalyst mailing list