On 5 Dec 2002 22:25:55 -0000, [EMAIL PROTECTED] (Rafael
Garcia-Suarez) wrote:

> There are two ways to determine a module's version :
> * the canonical way, which perl uses : call Some::Module->VERSION().
>   Unfortunately, this requires the module to be loaded. Loading a
>   module doesn't always succeed, and triggers execution of BEGIN blocks.
> * the heuristical way, which MakeMaker uses : parse the module's source
>   code and eval() the line that defines $VERSION. Doesn't always work.
> My mathematical self prefers the first. My pragmatic self, the other.
> Have you a preference ?

I usually use   perl -MSome::Module -le 'print $Some::Module::VERSION'
and assume that the module defines a variable called $VERSION.

Of course, this also executes BEGIN blocks and may also do other
"expensive" things such as load shared libraries &c.

Cheers,
Philip

Reply via email to