> Ugh... Assume that the view gets everything from controller. Then this
> controller is the thing that should gather everything together before
> shipping it to the view.  Let the template decide the form, let the
> controller decide the content.

That's fair enough, but say you've got 20 possible page elements of which
typically 5 or 6 are included in the final page. Would you still suggest
that the Controller should initialize any data for all 20 elements onto the
stash?

What if some of those elements are relatively expensive to generate?

What Steve wants is some way of being able to decide in the View which of
those elements are included and load them accordingly.

The best solution I can come up with is passing coderefs into your view
which can then be run to retrieve the data would something like this work?

$c->stash->{'get_most_popular'} = sub {
  return $c->model('DB')->some_expensive_db_op();
};


Carl


Thanks all for your interest and comments.

One significant issue with this one also is that many of the things to be assembled on the final page could appear on many different pages. So the issue is around how to generalise those common functions, to be accessible (optionally) from many pages.

...unfortunately, and as a stop-gap measure, the easiest and most robust way of handling it has been to bloat the Seamstress skeleton.pm with it -- i.e. lots of pre-parsed html fragments and logic that will optionally flesh them out and bolt them into the main doc as appropriate. ...sort of blows away some of the Controller/View separation ... but the final skeleton seems to be the only place that things are brought together again Please let me know if I'm missing something fundamental here... but at face value, I couldn't see any intrinsic capability for that sort of thing... much needed in enterprise (size/complexity) applications... to avoid going the WebSphere/Portal route. The app I'm working on is a CRM one... with various dashboard status, hot-list and other fragments that need displaying on many different pages.

SteveH

_________________________________________________________________
Advertisement: 1000s of Sexy Singles online now at Lavalife - Click here http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%26a%3D27782&_t=762229680&_r=lavalife_apr07_1000sexysingles&_m=EXT


_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to