Skip Menu |

This queue is for tickets about the version CPAN distribution.

Report information
The Basics
Id: 72001
Status: resolved
Priority: 0/
Queue: version

People
Owner: jpeacock [...] cpan.org
Requestors: xiong [...] cpan.org (daily)
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.94
Fixed in: (no value)



Subject: Failure to self-upgrade
Hi John, I'm now faithfully demanding version 0.94 but this is causing a new issue. Machines with earlier versions of version.pm are having difficulty upgrading; they're sending NA smoke reports. I've downgraded my own installed version.pm to 0.88 and successfully reproduced the issue, failing to install my own just-released Error::Base 0.0.2, which requires version 0.94. I'm attaching: lib/Error/Base.pm # module in question Build.PL # installer version-cpan.log # 'cpan' attempt to install These may be somewhat lengthy so here are inline excerpts: # Base.pm package Error::Base; use 5.008008; use strict; use warnings; use version 0.94; our $VERSION = qv('0.0.2'); # Build.PL use 5.008008; use strict; use warnings; use Module::Build; my $builder = Module::Build->new( module_name => 'Error::Base', license => 'artistic_2', dist_author => 'Xiong Changnian <xiong@cpan.org>', dist_version_from => 'lib/Error/Base.pm', requires => { 'perl' => 5.008008, 'version' => 0.94, # version-cpan.log cpan[12]> install Error::Base ... CPAN.pm: Building X/XI/XIONG/developer-tools/Error-Base-v0.0.2.tar.gz Checking prerequisites... requires: ! version (0.88) is installed, but we need version >= 0.94 ERRORS/WARNINGS FOUND IN PREREQUISITES. You may wish to install the versions of the modules indicated above before proceeding with this installation Error evaling version line 'BEGIN { q# Hide from _packages_inside() #; package Module::Metadata::_version::p3; use version; no strict; $vsub = sub { local $VERSION; $VERSION=undef; use version 0.94; our $VERSION = qv('0.0.2');; $VERSION }; }' in /ark/rig/build/Error-Base-v0.0.2-ShLiMJ/lib/Error/Base.pm: version version 0.94 required--this is only version 0.88 at (eval 24) line 9, <GEN2> line 9. BEGIN failed--compilation aborted at (eval 24) line 9, <GEN2> line 9. failed to build version sub for /ark/rig/build/Error-Base-v0.0.2- ShLiMJ/lib/Error/Base.pm at /rig/lib/b/Module/Metadata.pm line 556, <GEN2> line 9. (/rig/bin/perl Build.PL exited with 6400) ____ Xiong Changnian XIONG@cpan.org
Subject: version-cpan.log
cpan[11]> m Error::Base Module id = Error::Base CPAN_USERID XIONG (Xiong Changnian <xiong-cpan@xuefang.com>) CPAN_VERSION v0.0.2 CPAN_FILE X/XI/XIONG/developer-tools/Error-Base-v0.0.2.tar.gz UPLOAD_DATE 2011-10-27 INST_FILE (not installed) cpan[12]> install Error::Base Running install for module 'Error::Base' Running make for X/XI/XIONG/developer-tools/Error-Base-v0.0.2.tar.gz Fetching with LWP: ftp://cpan-sj.viaverio.com/pub/CPAN/authors/id/X/XI/XIONG/developer-tools/Error-Base-v0.0.2.tar.gz Checksum for /ark/rig/sources/authors/id/X/XI/XIONG/developer-tools/Error-Base-v0.0.2.tar.gz ok CPAN.pm: Building X/XI/XIONG/developer-tools/Error-Base-v0.0.2.tar.gz Checking prerequisites... requires: ! version (0.88) is installed, but we need version >= 0.94 ERRORS/WARNINGS FOUND IN PREREQUISITES. You may wish to install the versions of the modules indicated above before proceeding with this installation Error evaling version line 'BEGIN { q# Hide from _packages_inside() #; package Module::Metadata::_version::p3; use version; no strict; $vsub = sub { local $VERSION; $VERSION=undef; use version 0.94; our $VERSION = qv('0.0.2');; $VERSION }; }' in /ark/rig/build/Error-Base-v0.0.2-ShLiMJ/lib/Error/Base.pm: version version 0.94 required--this is only version 0.88 at (eval 24) line 9, <GEN2> line 9. BEGIN failed--compilation aborted at (eval 24) line 9, <GEN2> line 9. failed to build version sub for /ark/rig/build/Error-Base-v0.0.2-ShLiMJ/lib/Error/Base.pm at /rig/lib/b/Module/Metadata.pm line 556, <GEN2> line 9. (/rig/bin/perl Build.PL exited with 6400) Could not read metadata file. Falling back to other methods to determine prerequisites CPAN::Reporter: Build.PL result is 'na', Perl version too low. CPAN::Reporter: preparing a CPAN Testers report for Error-Base-v0.0.2 CPAN::Reporter: sending test report with 'na' via Metabase Warning: No success on command[/rig/bin/perl Build.PL ] XIONG/developer-tools/Error-Base-v0.0.2.tar.gz /rig/bin/perl Build.PL -- NOT OK Running Build test Make had some problems, won't test Running Build install Make had some problems, won't install Failed during this command: XIONG/developer-tools/Error-Base-v0.0.2.tar.gz: writemakefile NO '/rig/bin/perl Build.PL ' returned status 6400 cpan[13]>
Subject: Base.pm

Message body is not shown because it is too large.

Subject: Build.PL
use 5.008008; use strict; use warnings; use Module::Build; my $builder = Module::Build->new( module_name => 'Error::Base', license => 'artistic_2', dist_author => 'Xiong Changnian <xiong@cpan.org>', dist_version_from => 'lib/Error/Base.pm', requires => { 'perl' => 5.008008, 'version' => 0.94, 'Scalar::Util' => 0, 'overload' => 0, #~ '' => 0, }, recommends => { 'Devel::Comments' => '1.1.4', }, build_requires => { 'Test::More' => 0.94, }, add_to_cleanup => [ 'Error-Base-*' ], meta_merge => { resources => { repository => 'http://github.com/Xiong/error-base', }, keywords => [ qw( devel development error errors exception exceptions OO object-oriented class object method carp croak ) ], }, ); $builder->create_build_script();
The problem is that you cannot require a specific release of version in the Base.pm file itself, because that test will fail before Module::Build has had a chance to create the ./Build file. This will prevent CPAN from actually installing the correct version.pm code If you change this line: use version 0.94; our $VERSION = qv('0.0.2'); to use version; our $VERSION = qv('0.0.2'); you will see that CPAN will correctly read the requirements from the Build.PL and install the latest version.pm before attempting to continue and build/test/install Error::Base. The use of ... requires => { 'perl' => 5.008008, 'version' => 0.94, ... in Build.PL is sufficient to install version-0.94 or better prior to building your module.
Thanks for checking in, John. I'm confused, though. POD for version.pm says: use version 0.77; our $VERSION = qv("v1.2.3"); Last bug I reported, I noticed you hadn't changed this, even though version.pm is at 0.94; and I wondered about that. Now you're saying: use version; our $VERSION = qv("v1.2.3"); Obviously, I can go either way. But I'm confused. Which is better? Thanks again, XIONG
On Sun Oct 30 07:07:28 2011, xiong wrote: Show quoted text
> Thanks for checking in, John. I'm confused, though. POD for version.pm > says: > > use version 0.77; our $VERSION = qv("v1.2.3");
The POD is essential wrong and will be changed in 0.95. The issue is specific to Module::Build and what it does to create the ./Build script; ExtUtils::MakeMaker doesn't evaluate the $VERSION string of the module about to be installed. This may make it plainer. What CPAN does is this: 1) downloads, unpacks, and runs either Build.PL or Makefile.PL for the requested module; 2) if there are any missing dependencies, CPAN will loop on installing those first (essentially does steps 1-3 for each dependency); 3) once all dependencies have been resolved, CPAN will make, test, and install the requested module. The problem here is that Module::Build actually tries to eval() the entire $VERSION assignment line in step #1 and fails, because CPAN hasn't resolved the dependencies in step #2 yet. This is very specific to the version.pm code itself and was the reason why Module::Build used to ship with an inline copy of the latest version.pm code.