My thoughts...
Should my module's methods croak, or return error codes when they fail?
Error codes. Over the years, I've run into more libraries than I care to think about (mostly C, not perl) which die and take my app down with them when they think something went wrong. I don't care if your code absolutely, positively has to have a certain database available in order to function - return an error code so that the caller can then decide to use an alternate implementation, create the database you need and try again, or just die if nothing else works. Unless you know that there is no way the caller could possibly cure your 'fatal' condition, just tell it. Don't croak without warning.

Side question: I'm currently debating with myself over when it's appropriate for a method to report an error to STDERR on its own instead of just passing back an error code to the caller and letting them decide whether to report it or not. Thoughts?

How much internal error checking is sensible?
Sanity checking is always good. Don't make assumptions in your code - if it's possible for you to be passed bad data, make a reasonable effort to ensure that you didn't.

Should I use generic methods that can both get and set, or is a single one each
I go with generics. In my experience, that seems to be the more common perl idiom.

What works best, lots of methods to set things, or via the constructor in one go?
Both!

In reply to Re: Thoughts On Object-Oriented Module Design. Input Sought. by dsheroh
in thread Thoughts On Object-Oriented Module Design. Input Sought. by ajt

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.