Home > Archive > PERL Beginners > August 2005 > use Module VERSION; ignoring version???
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
use Module VERSION; ignoring version???
|
|
| JupiterHost.Net 2005-08-25, 9:55 pm |
| How come "use MODULE VERSION;" works sometimes and not others?
In this case:
$ perl -mstrict -we 'use CGI 3.12;print "$CGI::VERSION\n";'
CGI version 3.12 required--this is only version 3.11 at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
$ perl -mstrict -we 'use File::Copy::Recursive 0.15;print
"$File::Copy::Recursive::VERSION\n";'
0.14
$
Very odd...
is it the 0.nn ? if so thats weird because that is what h2xs starts with
by default 0.01
| |
| Bob Showalter 2005-08-25, 9:55 pm |
| JupiterHost.Net wrote:
> How come "use MODULE VERSION;" works sometimes and not others?
>
> In this case:
>
> $ perl -mstrict -we 'use CGI 3.12;print "$CGI::VERSION\n";'
> CGI version 3.12 required--this is only version 3.11 at -e line 1.
> BEGIN failed--compilation aborted at -e line 1.
> $ perl -mstrict -we 'use File::Copy::Recursive 0.15;print
> "$File::Copy::Recursive::VERSION\n";'
> 0.14
> $
>
> Very odd...
If you look here:
http://search.cpan.org/src/DMUEY/Fi...13/Recursive.pm
You'll see that the author of this module has incorrectly implemented the
VERSION method as:
sub VERSION { $VERSION }
From perldoc UNIVERSAL:
"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.
You should notify the module author to fix this (by removing his method)
| |
| JupiterHost.Net 2005-08-26, 6:56 pm |
| > You'll see that the author of this module has incorrectly implemented the
> VERSION method as:
>
> sub VERSION { $VERSION }
>
>
> "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.
>
> You should notify the module author to fix this (by removing his method)
Whoa, thats new :) I was always under the impression that sub VERSION
could be specified in modules and was in fact encouraged (Don't ask me
where I got that idea though ;p), but UNIVERSAL takes care of it for you
in the same way import() is handled (IE I know I know *not* by
UNIVERSAL, its the principle I'm comparing it to) if there is no
explicit import() function?
I happen to know the author and he's pretty awesome about this sort of
thing and will let him know so he can fix it :)
Thx :)
|
|
|
|
|