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

Alejandro Imass alejandro.imass at gmail.com
Sun Jul 18 23:34:48 GMT 2010


On Sun, Jul 18, 2010 at 6:47 PM, Tomas Doran <bobtfish at bobtfish.net> wrote:
>
> On 18 Jul 2010, at 21:42, Alejandro Imass wrote:
>>
[..,]
>
> No, Catalyst::Model::Factory does _exactly_ and _only_ this for you, so you
> probably/possibly want to use that rather than writing it yourself :)
>

Yeah, I saw the POD on CPAN after writing the mail...

> Another possibility it's well worth looking into if appropriate is
> Catalyst::Component::InstancePerContext, which handles all of the logic to
> put the instance which is generated by the factory into the stash for you,
> so that subsequent requests to $c->model('Foo') in the same request get back
> the same instance...
>

Cool! Will look into that now that I'm staring to fully understand.

> In some cases (if you're changing the state of this model during a request)
> then that's likely what you're looking for.
>

Thanks for all your help!
Alejandro

> Cheers
> t0m
>
>
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>



More information about the Catalyst mailing list