Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
... I included use v5.10.0; is because it is the minimum version of Perl needed to use the module since it uses // ...

To my mind, a use VERSION; statement should generally not be in a unit test script, but in the module that is under test. (Of course, there will be odd cases when such a statement needs to be in a test script, but I expect these cases to be rare.) I try to write unit tests to be compatible with the absolute minimum Perl version, although in practice this works out to be version 5.8.8. :)

Placing a use VERSION; statement as the first statement in a module (and in scripts as needed) as kcott recommends here is part of compile-time checking of environmental requirements. I always include a version assertion except when the code is so generic as to be digestible by even the most hoary version of Perl. Further, having this statement as the first statement in a module as kcott suggests can immediately alert the reader to a minimum version requirement.

It is really the business of each module to police its minimum environmental requirements, including Perl version. These requirements may change radically as the module evolves, and you don't want to have to keep track of all that in a test script. Also, a given application may use a wide variety of modules with widely differing minimum requirements. The use_ok test will catch a mismatch between a module and the test environment right from the git-go.

Give a man a fish:  <%-{-{-{-<

In reply to Re^3: RFC: How did I do writing my first test? by AnomalousMonk
in thread RFC: How did I do writing my first test? by Lady_Aleena

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, 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
  • 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.
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (6)
    As of 2021-03-02 12:06 GMT
    Find Nodes?
      Voting Booth?
      My favorite kind of desktop background is:

      Results (46 votes). Check out past polls.