http://www.perlmonks.org?node_id=863852


in reply to Singleton Objects for DBI Connection

If you're using mod_perl, your code is becoming part of the web server. Apache loads up your code during initialization. Your code isn't forked, executed, and killed. Instead, it's called when needed. After it returns, it remains resident to be called again when a new request for it arrives.

Since your code never runs down, your database connection remains open and the same connection will be used by the next request. This is one of the advantages to running under mod_perl - your module's initialization code gets executed once when Apache starts up instead of once per connection. As a result, you can get right down to processing the request which makes your application faster to respond.

90% of every Perl application is already written.
dragonchild
  • Comment on Re: Singleton Objects for DBI Connection

Replies are listed 'Best First'.
Re^2: Singleton Objects for DBI Connection
by asafp (Novice) on Oct 10, 2010 at 13:24 UTC
    I think I understood.
    Thanks!