That's not what I'm talking about. See Everything you wanted to know about Module Version Numbers and Checking, specifically,
The thing between the module name and the list must be a v-string or numeric literal. Anything else is rejected by the parser, unlike the normal indirect-object syntax that can be overridden with braces even if it doesn't smell like an indirect object.

For example, you cannot write:

use VersionTest '1.2.3' qw/foo bar/; #string my $needed= v2.3.4; use VersionTest $needed qw/foo bar/; #not a literal
A variable named $package::VERSION is just another scalar and you can do anything with it.

For the require/use VERSION only (what you thought I meant?) to assert the perl version, it will take a float or a v-string to serve this purpose, and any other string including "1.2beta4a" as a module name instead. Using floats and the 3-digit convention, you are limited to the significance of the float (is that enough parts?).

Throwing v-strings into the mix doesn't cause any more problems than having numbers and strings (both) available. If you define module's $VERSION="1.0.2"; and use the old-style import method for asserting the version desired 1.0.4, it will use == in the comparison and ignore everything after the 1.0 in both cases, causing a false "accept".

here is a much better approach, IMHO, but that's not "built-in" to the semantics.

Funny thing is, using the indirect object syntax is a bit of a hack anyway, since that's not directly fed to the import method. Maybe I should forget that and encourage a revival of the "old" method, passing the desired version as an argument to the import list?

—John


In reply to Re: Re^3: Distinguishing a v-string from something else by John M. Dlugosz
in thread Distinguishing a v-string from something else by John M. Dlugosz

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.