Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: use _specific_ version

by bikeNomad (Priest)
on Jul 09, 2001 at 19:30 UTC ( [id://95008]=note: print w/replies, xml ) Need Help??


in reply to use _specific_ version

I think the following will work with any version of Perl 5:
BEGIN { require 5.004; die "Requires only 5.004" if int($] * 1000) > 5004; }

update: why bother with the require, either? Just use the die and !=

Replies are listed 'Best First'.
Re: Re: use _specific_ version
by particle (Vicar) on Jul 09, 2001 at 19:40 UTC
    yes. this makes sense to me. is there good reason to use require inside 'BEGIN', or is use okay as well? i'm not sure of the subtle differences.

    ~Particle

      I believe that in this case, the import is skipped, so: use 5.004; is the same as BEGIN { require 5.004 }

      You want to check inside a begin block, anyway, so you do as little as possible with the wrong Perl.

      Note also that the version number could have more information; 5.6.1 is encoded as 5.006001 in $]. If you care about 5.6.0 vs 5.6.1, you need to multiply by 1000000 first and compare with the right number.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-16 14:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found