I've read that post, and that's why I said I would like to hear merlyn's thoughts. Basically, that post says the same thing I just said: You shouldn't ever need to call the
new method on an instance.
However, that doesn't mean that as the designer of a class, you can't provide the proper instructions to prevent an error when someone ELSE calls new on an object they got from your class, be it intentional or otherwise.
Personally, I consider the following two statements to be equally as ridiculous:
Don't use ref($proto) because users of your module/class should never call a constructor on an instance.
Don't check to make sure open() succeeded because a user should always make sure they're running your program with the proper permissions to open a file.
Either way, you're depending on someone else not to break your code, and that can't be good.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.