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

Ron Savage ron at savage.net.au
Tue Nov 29 19:01:04 EST 2011


Hi Matthias

On Sun, 2011-11-27 at 17:24 +0100, Matthias Ferdinand wrote:

> I could not find in CGI::Application's docs if a single instance object
> is capable of handling multiple requests (i.e. has run() invoked several
> times) or not.

I'm a bit surprised you haven't had an answer by now.

IMHO I'd say it won't work by default.

That is, you'd have to either recreate the instance obj, or find all
variables which need re-initializing, and have a method to do just that.

But there's a catch: Who's to say even that would work, since plug-ins
would also need to be re-inited.

So, don't do it that way. Just accept that you need a new instance obj
each time.

Note specifically this does not mean you need to re-start your server
each time.

And for a persistent environment, I'd strongly suggest you switch to
Plack.

[1] https://metacpan.org/search?q=Plack

[2] http://savage.net.au/Perl.html#plack_for_beginners_html

[3] http://savage.net.au/Perl.html#session_management_with_plack_html


-- 
Ron Savage
http://savage.net.au/
Ph: 0421 920 622



More information about the cgiapp mailing list