in reply to How do I require a specific version?

Exporter provides import for most modules, and Exporter's import has support for version checking. However, Module::Pluggable does not use Exporter. It has a custom import which doesn't provide support for version checking.

Looking into Exporter, I see it calls the function VERSION from UNIVERSAL, so all you have to do is:

BEGIN { require Module::Pluggable; Module::Pluggable->VERSION(2.9); } use Module::Pluggable ...your usual args...;

That's the first I've heard of the UNIVERSAL::VERSION function. neat!

Replies are listed 'Best First'.
Re^2: How do I require a specific version?
by jk2addict (Chaplain) on Jul 27, 2005 at 01:41 UTC

    Big duh. I never though that VERSION took an argument.

    VERSION ( [ REQUIRE ] )
    VERSION will return the value of the variable $VERSION in the package the object is blessed into. If REQUIRE is given then it will do a comparison and die if the package version is not greater than or equal to REQUIRE. VERSION can be called as either a class (static) method, an object method or a function.