Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^6: Why eval $version?

by Haarg (Curate)
on Jul 10, 2020 at 10:04 UTC ( #11119130=note: print w/replies, xml ) Need Help??


in reply to Re^5: Why eval $version?
in thread Why eval $version?

Correct. use Module 1.2; is equivalent to:

BEGIN {
    require Module;
    Module->VERSION(1.2);
    Module->import;
}

The ->VERSION method on perl 5.8 just uses a simple numeric comparison against $VERSION. On modern perls, it understands both numeric versions and multi-part versions, as well as underscores. The version.pm module can be loaded on perl 5.8 to allow it to understand these versions.

"Static" parsing is done by the toolchain modules that are concerned with installing, updating, and indexing perl modules. These modules don't want to have to load the entire module to be able to compare versions. They also need to be able to work with modules that are not able to be loaded, such as not having their dependencies available or requiring an XS component that is not compiled yet. With a use call, you are already telling perl to load the file, so there's no need for the extra work involved in "static" parsing.

Replies are listed 'Best First'.
Re^7: Why eval $version?
by LanX (Sage) on Jul 10, 2020 at 15:39 UTC
    so if all toolchain modules use version it should be also possible to use multi-part versions (like "v1.2.3_02") correct for Perl >5.10?

    Do they?

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Re^7: Why eval $version?
by LanX (Sage) on Jul 10, 2020 at 17:34 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11119130]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2021-10-21 05:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (82 votes). Check out past polls.

    Notices?