Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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

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:

  1. cgiapp_init()
  2. setup()
  3. your request handler, such as 'one' or 'two'
Therefore ... the object exists for the entire time!

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.


  • 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   Read it “entirely, thoughtfully, and carefully.”   Trust me ... the proverbial “little light” will come on.   :-)

In reply to Re: DB Connection using CGI::Application by sundialsvc4
in thread DB Connection using CGI::Application by Anonymous Monk

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (5)
    As of 2016-10-23 02:15 GMT
    Find Nodes?
      Voting Booth?
      How many different varieties (color, size, etc) of socks do you have in your sock drawer?

      Results (299 votes). Check out past polls.