If you are going to spout this oft-disputed advice, then at least tell them what you want them to use in place of the part you don't want them to use.

If you are suggesting my $class = shift; instead of the two lines (so no $proto at all), then you should also tell them to document that $obj->new() will silently do ugly things, creating a broken object that will likely cause confused error reports from users of their module.

Which certainly suggests to me a reasonable "purpose" for using the simple and defensive code that is suggested in the standard documentation, as the original poster did.

No, I really don't want to rehash this argument for the Nth time in this thread. Some feel strongly that $class = ref($proto) || $proto is a bad thing™. Some feel strongly otherwise. My point was that your incomplete advice in advocating your position was probably not very helpful to the original poster.

Feel free to advocate what makes sense to you. But please also say what to use not just what to not use and be aware of why this advice is often disputed and let them know what the down side of your suggestion is or link to one of the several long previous discussions of the issue. (:

                - tye

In reply to Re^2: module advice ($proto) by tye
in thread module advice by robobunny

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.