Ah, but that is not the reason I use UNIVERSAL::require.

In an effort to optimize for readability, I try to make sure that there are no bits of code that don't make perfect sense when being read.

Ofcourse, with some lines this just can't be done, but then you use comments.

The point is that eval "require $class"; is readable, but to when I read the code eval is one of the things that usually makes me pay close attention, and if this is only loading the module in $class, It's nothing special.

Loading a module is not what the lines where it's loaded are doing, but rather to what those lines need to do whatever it is they do.

By that rationale I prefer to make that code stand out less, so that I can switch focus to the important code more quickly.

I know this might sounds a bit far fetched, but I tend to have a hard time concentrating when I'm reading, unless I'm in a very good state (happy, energized, not hungry, not thirsty, not in a rush, not too jumpy, not too distracted...

-nuffin
zz zZ Z Z #!perl

In reply to Re^5: Gracefully choosing which module to use by nothingmuch
in thread Gracefully choosing which module to use by kaif

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.