Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I "require" a certain version of a Perl module?

I have some Perl code that uses require instead of use to load a specific module, and I have just discovered that my code requires a minimum version on that module. However, unlike use, require does not seem to have a version argument when loading a module. So what is the proper way to do this?

like image 221
Ryan C. Thompson Avatar asked Dec 02 '13 08:12

Ryan C. Thompson


1 Answers

You can call for VERSION method, it's inherited from the UNIVERSAL class. It checks for $Module::VERSION variable:

require Any::Module;
Any::Module->VERSION('2.3');
like image 71
Suic Avatar answered Sep 21 '22 09:09

Suic