Esteemed Monks

Thanks to the The Monastery, I today found out about Perl::Critic so thought I would throw a recently written, small (600 lines) Perl script at it just for fun...so I used the website tool knowing that it would complain that scriptures were off.

It has highlighted 12 issues amongst them:
"require" statement with library name as string at line 10, column 1. Use a bareword instead.

I've looked this up and understand what it is suggesting I do

require "incl/common.pl"; # What I've got require incl::common.pl; # What Critic suggests I have

I've consulted the documentation for require and I understand the portability advantage of the slash being the other way on some systems. As my code will never be run in another environment, I don't see the advantage of backdating the code for this reason but going forward, that makes sense.

But then we get to autovivification...
Off to the Wikipedia Article as this is a term I have heard but always shied away from...time to properly understand. I think I now sort of understand but certainly not well enough to articulate it to myself let alone explain it to anyone else.

I do understand that the syntax I have used for require will not autovivify whereas the version suggested by Critic will. What I certainly do not understand is how this makes any practical difference in any way. Whether the magic happens at compile time or run time surely doesn't matter here as the code only runs once for each executed instance; which equates to someone (or some machine) requesting a page from the webserver. I totally get that in many cases there are major differences between compile and run time - but here in a require statement?

Does it actually matter in practical terms or is autovivification in this example just a theoretical matter here?


In reply to Autovivification with require by Bod

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.