[cgiapp] need a fresh WebApp instance with every request ?

Matthias Ferdinand mf+cgiapp at mfedv.net
Fri Dec 2 13:17:50 EST 2011


On Fri, Dec 02, 2011 at 03:57:49PM +0000, Larig Tech wrote:
> I like half your idea and hate the other half :o)

Of course it would not be a real solution, more like a very defensive
workaround, trying not to mess with any of CA's internals.
So MyApp would not _be_ a CA anymore, but only _have_ a CA (a ref to it
comes with the method calls, or might be acquired with a separate method
call immediately following CA instance creation). And I would not have
restrictions for the internals of MyApp, I could use class storage and /
or object storage and what not.

The only _real_ solution would be adding multi-request capability into
CA (+ plugins) natively. That was my first idea, since the workaround
with the few plugins I use is just a few lines in teardown(). But after
reading more of the CA source and some of the plugins I got nervous and
switched to defensive mode :-)
Essentially I don't know what plugins exist (that people have written
themselves and that are not found on CPAN) that might stop working after
my changes.  Then I couldn't even call them names for not following the
plugins API (which I guess does not exist).

> There's another reason your framework wouldn't win me over -- it only
> handles the situation where a singleton is sufficient.
a CA singleton? or a MyApp singleton? Of course it would be a real mess
to have a MyApp instance cope with intermingled callbacks from different
CA objects. The coupling of CA object and MyApp object should be
monogamic (until the CA object ceases and the MyApp object is free to
mate again.. :-) But multiple MyApp instances each tightly coupled with
a single short-lived CA instance should work. Perhaps I just misunderstood.

Regards
Matthias


More information about the cgiapp mailing list