[cgiapp] use persisten instance of cgiapp with cgi::fast?

Mark Fuller azfuller at gmail.com
Mon Jul 19 11:20:35 EDT 2010


On Mon, Jul 19, 2010 at 4:16 AM, Dietrich Streifert
<dietrich.streifert at visionet.de> wrote:
>
> I'm currently using speedy_cgi as a persistent perl process and wanted
> to test if fcgi would be an option for me.

Is speedy_cgi safe to use for a larger, longer-term application?
(I.e., widely used, still maintained?). The last time I looked at it,
I got the impression it was a niche tool. (It hadn't been updated
since 2003, wasn't part of CPAN.). It looked like something that
served a purpose a few years ago and fell into disuse(?).

Regarding your DB connections, all DB connections should be wrapped in
an eval so you can catch failures. What I do is lazy connecting. I let
the first DB operation die (in the eval), and perform the connection
at that part (as part of an error-recovery routine to retry failures
3-4 times with increased waits between tries). Therefore, I'm just
passing around a class variable (a reference to it) which requires no
initialization at instantiation.

It's just a matter of turning around how you think of your DB
connection. An initialization process? Or, a reference to a handle
that can be initialized when necessary (after the first try which
fails, or any subsequent try that fails).

Mark


More information about the cgiapp mailing list