Both examples are 2 lines. Yet solution that uses a module had (at the time I last checked) more votes than the core solution that didn't use a module at all. Is it really that much easier to read the 2nd solution?

Read some of educated foo's crusades against one-liner CPAN modules here and here for a counter-argument to using small CPAN modules. Just for the record, I don't agree with the premise, but I respect the argument.

Some of these small modules have been zenned to a functional minimum and yet may deal with subtle edge cases invisibly, or in some way Do The Right Thing.

And once the code has been hidden behind the interface of a module, it doesn't really matter what it looks like. If there's a bug, it can be corrected and you don't have to do anything. You can't do that when the snippet is scattered inline repeatedly across a large swath of code. If it's too slow, it can be XSified, and still you don't have to change anything on your side.

I believe that the more you use modules, the more you can chunk things and operate at a higher level. I've used LWP::UserAgent and HTTP::Request for years, and have looked at the code for probably all of two minutes. And of the two minutes I spent, the main thing I took away was "Gee, I'm glad I don't have to worry about that."

• another intruder with the mooring in the heart of the Perl


In reply to Re: Module Bloat and the Best Solution by grinder
in thread Module Bloat and the Best Solution by KurtSchwind

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.