Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Perl is not a language of dictatorship. If you want to blow your own foot off, you can. There is no "private" scope modifier - just a convention of a leading underscore on otherwise private function names. But, if you know what you're doing, you're completely free to call them.

I firmly believe in caching, delayed evaluation, and uncluttered namespaces. Caching means I don't calculate the same value twice if it can be helped, especially if the calculation is expensive (note that "calculation" does not just mean "arithmetic" - calculating the list of files that match a certain regexp from across an NFS share is a calculation - and an expensive one at that).

Delayed evaluation means that I don't calculate everything up front - if, in the current run of the program/script/module, I don't need certain information, I don't calculate it at all. This follows into loading other modules: if there are valid codepaths which may not need another module, I usually simply "require" the module during the calculation.

And uncluttered namespaces means I like to import as little as possible to make it less likely that I get any collisions.

Of course, this is all simplified by the fact I also use OO as much as possible - objects cache their own calculations (if that makes sense), I load those modules as needed (OO doesn't solve your compilation-failing scenario though), and OO modules rarely export functions to clutter the caller's namespace.

This doesn't say I never export functions in my modules. Just that there has to be a really good reason to do so.


In reply to Re^4: brian's Guide to Solving Any Perl Problem by Tanktalus
in thread brian's Guide to Solving Any Perl Problem by brian_d_foy

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (6)
    As of 2014-09-17 06:10 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (60 votes), past polls