Don't know if you noticed but I'm not actually passing DBH. I'm passing reference to instance of DBIx::Handy actually.

The thing that I dont understand about singleton's. I know that you can create only one at any given time - but is that sort to say system wide - or just in that process?

I believe it's just for that process of course - but then again it raises questions what happens when you work under mod_perl or similar (threads?)

Anyway the code that you wrote (just checking if I understood everything right) allows me to create more instances of DBIx::Handy, but only one DB connection?

Problem is that I will need two DB connections as at one point of time, I need to read data from another DB ... One idea would be to use Memoize and since call to connect would have different parameters it would create different DBH. Then it gets even more complicated :) As to do so I need to store several DBH and somehow tell to DBIx::Handy which one to use for particular query...

I like your idea as it's simple...

In reply to Re^2: OOP design related question. by techcode
in thread OOP design related question. by techcode

Title:
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, details, 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, summary, 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.