Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Run-time equivalent of "use Module VERSION"?

by Corion (Patriarch)
on Jul 04, 2014 at 07:50 UTC ( #1092256=note: print w/replies, xml ) Need Help??


in reply to Run-time equivalent of "use Module VERSION"?

VERSION is magic and always there for you:

> perl -wle "package VersionTest; use vars qw($VERSION); $VERSION=666; + package main; print VersionTest->VERSION(666); print VersionTest->VE +RSION(667);" 666 VersionTest verion 667 required--this is only version 666 at -e line 1 +.

Replies are listed 'Best First'.
Re^2: Run-time equivalent of "use Module VERSION"?
by LanX (Sage) on Jul 04, 2014 at 13:07 UTC
    > VERSION is magic and always there for you:

    elaborating a bit from perlobj#VERSION($need) :)

    UNIVERSAL::VERSION() is like ->can() a "universal"¹ method and ...

    This method is called automatically by the "VERSION" form of "use".
    use A 1.2 qw(some imported subs); # implies: A->VERSION(1.2);

    Cheers Rolf

    (addicted to the Perl Programming Language)

    ¹) All classes automatically inherit from the UNIVERSAL class, which is built-in to the Perl core.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2023-03-23 05:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (60 votes). Check out past polls.

    Notices?