[Catalyst] Catalyst::Component/Model Instances and Attributes per Request

Alejandro Imass alejandro.imass at gmail.com
Sat Jul 10 17:37:44 GMT 2010


Hi,

If in a Catalyst::Component, say an extension of Catalyst::Model, the
attributes of my instance are also per-request. In other words if I do
$self->yuca($c->stash->{yuca}) in ACCEPT_CONTEXT and return $self,
will $self->yuca in the Model _instance_ in a separate memory space
for this request? I would suspect that a Catalyst::Controller instance
is paired with a single Model instance for a specific request.... but
I'm afraid that being an _instance_ instead of a class, the attributes
may get overriden by a second request that could be running in a
parallel process or thread, say in mod_perl running on Apache prefork
or worker (threads). Then again, I guess I'm answering myself as one
request will run in one process or thread and the data segment is
protected by the underlying OS, so I see no way a second request can
override the attributes of a model instance.

Well, maybe it's a stupid question but just to be sure... any comments
greatly appreciated!

Thanks,
Alejandro Imass



More information about the Catalyst mailing list