Hello! I'm developing a module of useful web/db functions. Several of the functions need to use an existing DBI $DBH handle, and I'm trying to figure out the most stylish way to arrange this. Here are my constraints: I want to put the functions into a module that doesn't require any other modules except for CGI.pm. If I just pass in the $DBH through as one of the function args, that seems like a bit inefficient, since I _always_ need to pass it in.
example: my_function($DBH, @args)
The other possibility seems to be make the function an OO method, which gives me the syntax:
example: $DBH->my_function(@args)
That perhaps might look cleaner, but OTOH, it doesn't really save much typing per function call. So the question is, when developing a routine that's always going to need a object reference to be passed in, what's a good style to handle this in? Thanks.

In reply to need help developing fly OO style by markjugg

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.