in reply to DB Connection using CGI::Application
If you are trying to pass a database connection-handle as a param(), then I would say .. “fuhgeddaboudit!.” You’re barking up the wrong tree .. the intended solution is actually much simpler(!) than you are making it out to be.
Pause for a moment and consider how CGIApp actually works. (See also http://cgi-app.org/index.cgi?OrderOfOperations.)
Your CGI application comes into existence to handle one request ... then, it dies. The sequence of operations, during the lifetime of that one-and-only request, includes the following method calls:
- cgiapp_init()
- setup()
- your request handler, such as 'one' or 'two'
Each of these methods occur within a single object, so you actually are free to instantiate any necessary database connection-handles at any point that suits you. The only thing to bear in mind, from a program-design point of view, is that each of these are method calls, to a single (albeit short-lived...) object, which occur in a definite sequence.
Literally...
- The CGI process starts. The object is instantiated.
- The method-calls occur in the stated sequence.
- The object coughs-up its output .. then the entire process dies. (Hey.. life is short... sux.)
I cordially suggest that you should now spend a bit of time at http://www.cgi-app.org. Read it “entirely, thoughtfully, and carefully.” Trust me ... the proverbial “little light” will come on. :-)
Replies are listed 'Best First'. | |
---|---|
Re^2: DB Connection using CGI::Application
by Anonymous Monk on Apr 24, 2013 at 19:34 UTC | |
Re^2: DB Connection using CGI::Application
by Anonymous Monk on Apr 25, 2013 at 03:43 UTC |