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?
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');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With