[Catalyst] C::M::{CDBI,DBIC} vs direct Loader use?

Perrin Harkins perrin at elem.com
Thu Nov 17 03:54:45 CET 2005


Brandon Black wrote:
> That's about the closest to clean now that I've seen so far that
> actually works.  But I'll have to remember to wrap all of my date
> variables used in templates ( [% timezone_ize(some_date_variable) %]
> ).

You already have to do that for things that need HTML-escaping.  This is 
no worse, IMO.

> The method of subclassing Catalyst::View::TT and pre-processing the
> stash variables in a custom process() method before calling
> NEXT->process() looked promising, but the issue there is that the
> stash can be many arbitrary levels of nested objects, arrays, hashes,
> etc, and I'd have to find a way to traverse them all in search of
> DateTime objects, which would be both ugly and expensive.

There must be a handy module for this.

> The ultimate place to hook this in is in Template::Stash->get() I
> think

That would require you to subclass it, and will kill at least some of 
the performance benefit of the XS Stash.

> honestly this is all a lot more trouble than just being unclean about
> it and using a Catalyst::Plugin::Singleton context from my Model
> during inflate().

Sounds like it, although there is an argument to be made that your model 
should represent the data in a user-independent way.

- Perrin



More information about the Catalyst mailing list