7

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?

Ryan C. Thompson
  • 40,856
  • 28
  • 97
  • 159

1 Answers1

8

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');
Suic
  • 2,441
  • 1
  • 17
  • 30