Subject: | CPANPLUS::Configure has bad $VERSION |
The following is my answer to an email about a possible MakeMaker problem. In the process of answering that I discovered that the $VERSION in CPANPLUS/Configure.pm is poorly done.
Show quoted text
> I've also started getting this error in 'cpan' ONLY:
>
> Could not eval '
> package ExtUtils::MakeMaker::_version;
> no strict;
>
> local $VERSION;
> $VERSION=undef; do {
> \$VERSION = $CPANPLUS::Internals::VERSION;
> }; $VERSION
> ' in /usr/local/lib/perl5/site_perl/5.8.0/CPANPLUS/Configure.pm: Can't modify single ref constructor in scalar assignment at (eval 110) line 7, at EOF
This I can reproduce and its unrelated to the MM_VMS problem above.
That's a bug in CPANPLUS::Configure. In fact, there's several of them.
They do this:
\$VERSION = $CPANPLUS::Internals::VERSION;
Which, AFAIK, shouldn't work:
~ $ perl -wle '$Foo::VERSION = 42; \$VERSION = $Foo::VERSION; print $VERSION'
Can't modify single ref constructor in scalar assignment at -e line 1, near "$Foo::VERSION;"
Execution of -e aborted due to compilation errors.
So the error is legit. What they should try instead is:
*VERSION = \$CPANPLUS::Internals::VERSION;
but there's *another* bug in there. That CPANPLUS::Internals is never
loaded by CPANPLUS::Internals! More than likely it just happens to be
working because whenever they load CPANPLUS::Configure they also happen
to have CPANPLUS::Internals loaded. And since MakeMaker has to see all
the information necessary to figure out the version on one line...
require CPANPLUS::Internals; *VERSION = \$CPANPLUS::Internals::VERSION;
though it kinda sucks to have to load up one module to figure out the version of another. In which case I'd recommend just copying the version # out of CPANPLUS::Internals and pasting it into Configure. Or decoupling the version # of the two as I don't see any obviousl reason why they have to be the same.
But its *still* not correct because if you look at CPANPLUS/Configure.pm
you'll see that this is in fact the $VERSION for CPANPLUS::Config!
CPANPLUS::Configure has no $VERSION.
So the above should be moved into the CPANPLUS::Configure package and CPANPLUS::Config should simply say:
*VERSION = \$CPANPLUS::Configure::VERSION;