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

Matt S Trout dbix-class at trout.me.uk
Wed Nov 16 18:04:16 CET 2005


On Wed, Nov 16, 2005 at 11:40:43AM -0500, Perrin Harkins wrote:
> On Wed, 2005-11-16 at 06:59 -0600, Brandon Black wrote:
> > I've started looking into that route now... since this localization
> > should really happen generically to all DateTime objects being viewed
> > through my View, I'm kinda thinking I should override
> > Template::Stash's get() method to intercept (if ref  $_[0] eq
> > 'DateTime') DateTime objects and change their timestamp before passing
> > them on to the default get().  Or adopt a naming convention like I did
> > with the database that all DateTime's to be localized end in "_stamp",
> > and grep those variables out of the stash for post-processing in a
> > subclass of Catalyst::View::TT before they get sent to Template:: at
> > all.  Or something along those lines.
> 
> Most people solve this sort of issue in the template by writing a TT
> plugin (or even just a sub ref) that all the date display calls get
> wrapped by.

Yeah. Bear in mind that this works -

$c->stash->{foo} = sub { "Foo to you, $_[0]"; };

[% foo('Dr. Roberts'); %] # will add "Foo to you, Dr. Roberts" to the output

-- 
     Matt S Trout       Specialists in Perl consulting, web development, and
  Technical Director    UNIX/Linux systems architecture and automation. Mail
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list