[Catalyst] Catalyst::Component/Model Instances and Attributes per
Request
Tomas Doran
bobtfish at bobtfish.net
Sun Jul 18 19:36:27 GMT 2010
On 18 Jul 2010, at 19:58, Alejandro Imass wrote:
> So in conclusion, it seems reasonable to say that I should not worry
> about the global vars (the Moose object attributes) in my Model
> Instance to get overridden by the ACCEPT_CONTEXT call, as this call
> will only be called once in sequence with a single request. Anyone
> disagree?
Yes.
They're _still_ not global variables, they are instance variables, of
an instance which is scoped to the application lifetime.
And changing the values of them per-request is still entirely wrong,
yucky, bad design etc.
If you need an ACCEPT_CONTEXT method, than return a _different_
instance which has the mutable state, rather than smashing things in
your per-app instance and returning that.
(But yes, even if you do the thing I'm recommending against, it will
work without multiple threads stamping on each other).
Cheers
t0m
More information about the Catalyst
mailing list