On 15 Jul 2010, at 21:37, Alejandro Imass wrote:

On Mon, Jul 12, 2010 at 3:08 PM, Tomas Doran <bobtf...@bobtfish.net> wrote:
Each process is in a separate memory space if you're using FCGI or mod_perl
or something, but it's not entirely certain (if you use
Catalyst::Engine::PSGI and Corona (for example) then multiple requests can be in-flight and sharing the same logicial memory space application (they
just have different instances of the request context).


So we can assume mod_worker would certainly mix this data. The initial
quetion wasn't so stupid after all ;-)

I believe from perl space it'll all still look like different processes, so no..

However doing what you suggest above will work for FCGI/mod_perl (or
generally anything forked), although it's a bit icky - the instance of your
Model lasts forever, and so bashing some of the instance data in each
request works..


Yes. I think for this particular case it's better for me to use a
class rather than an instance for this model.

Wrong.

I'm suspecting that
instances are really to take advantage of caching DB connections and
things like that which I don't need or want for my particular model.

Wrong.

You want an instance. Always.

If you just had a class for your then it would be impossible to load two copies of the same class into the same process space at any time. And you wouldn't _ever_ want to connect to the same database schema on two different servers at the same time...

Oh, no, wait - you would :)

But that's fine, just inheriting from Catalyst::Model means that you have a COMPONENT method which will generate an instance... Although it's probably better to use ::Model::Adaptor or something, so that the COMPONENT instance creation logic and the actual implementation class aren't the same thing (and the actual class is decoupled from any Catalyst related logic).

Cheers
t0m



_______________________________________________
List: Catalyst@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/

Reply via email to