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

Brandon Black blblack at gmail.com
Wed Nov 16 13:59:49 CET 2005


On 11/16/05, Jules Bean <jules at jellybean.co.uk> wrote:
> Brandon Black wrote:
> > Am I missing something here, or does that about sum it up?  And would
> > using Singleton context access from within a method of a table within
> > a model be considered bad form? (This is back on that problem of
> > getting automatic timestamp column inflation/deflation to pay
> > attention to timezone settings for the current application
> > user/session).
> >
> > Any insight appreciated :)
> >
>
> I can't give you insight so much as opinion. Yes, I think Singleton is
> bad form, as a rule. I wouldn't do it that way. In terms of your
> specific problem, my MVC hunch is that in the model you should keeps
> times in some standard form (UTC, for example) and that it is the job of
> the View to format a time according to the user's timezone.
>

Yeah that's the opinion I was looking for I think, thanks.

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.

-- Brandon



More information about the Catalyst mailing list