[Catalyst] Componentised actions.

John Napiorkowski jjn1056 at yahoo.com
Wed Mar 28 23:56:37 GMT 2007



----- Original Message ----
From: Oleg Pronin <syber.rus at gmail.com>
To: catalyst at lists.rawmode.org
Sent: Wednesday, March 28, 2007 5:55:54 PM
Subject: [Catalyst] Componentised actions.

Greetings!

 

I'm developing a website based on catalyst and want it to be moduled and componentised the way like this:

 

site.com/object1/list 

   displays objects 1 in empty design.

 


site.com/object2/list 

   displays objects 2 in empty design.

 

site.com/nicepage

   displays a page in website design which contains result of processing actions 'site.com/object1/list' and 'site.com/object2/list
'.

 

The question one is how do i get the output of the actions inserted into another template ?

 

i mean something like 

 

page template page template

[% c.forward('/object1/list') %]

page template page template, 

 

just for example, this of course doesn't work.

 

 

The question two is how do i know while running in '/object2/list' action 

whether action is called from the browser or inserted into another template.

 

I.e. i want URL site.com/object1/list to display information in site design while the same action inserted into another template

( pseudo :) [% c.forward('/object1/list') %] )  to display information in empty desing (i.e. through another VIEW).

 

Any suggestions ?



  

Best regards, Pronin Oleg, Rambler Internet Holding.

Let me see if I understand what you are trying to do.  You want a portal like system where you have a parent page that contains units or regions that automatically dispatch to different actions and perform a full request cycle, including returning a response body suitable for including in the parent page.  If so that sounds like something I was trying to do earlier this year.  There is a Catalyst subrequest plugin (both in CPAN and a newer, unreleased version in the source control repository) which could in theory be used to make portal like applications.  However I wasn't able to get this to perform satisfactorily since the CPAN plugin has known limitations in terms of it's ability to properly scope stuff and I couldn't get the repository version to work at all (although might just be my ignorance, your results may vary)

There is a branch in the repo that is supposedly to make this kind of this easier (or at least that was my understanding of it) called "app_context_split" (at least that is what I think it was called) but the repo doesn't show any work on that since January and since I don't know about the goal of that branch or the outstanding TODO list I'm not sure what to say about it.  Maybe the author can speak up?

You could write a custom action class or something to do a cold, hard LWP http request.  I tried that but found the performance to be bad and there was a lot of trouble to make sure everything work right such as if the parent page gets a POST what does your 'portlet' (for lack of a better work) get?  Does it get a post with all the posted params and posted attachments?  Get's very expensive and there's a lot of plumbing to do.

In the end I gave up trying to make my application this way since I couldn't find an elegant way to do it that didn't require a lot of plumbing work on my part and also performed well.  The direction I took was to 'componentize' my page using TT's ability to include bits of other templates.  That way I have something like what I want, but I admit it isn't so perfect since I have more coupling between logic and presentation than is usually considered good practice.

Why not tell us a little more about what your application is trying to do and we can maybe advice a way around this problem.

--John









 
____________________________________________________________________________________
No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070328/ed122aa7/attachment-0001.htm


More information about the Catalyst mailing list