Subject: | version generated by qv not handled as per Module::Build if build invoked from Build.pl |
If a module version is set using eg
use version; our $VERSION = qv(1.2.0);
and this module is specified as the version_from module in Makefile.PL,
Module::Install warns that
WARNING: VERSION takes a string/number not a version reference.
Please inform the author.
However, if the same file is invoked as Build.PL, no warning is
generated and the version is still misset. The version is set correctly
if Module::Build is used.
mark:~/work/justice/tests/Module-Install$ cat Build.PL
use inc::Module::Install;
name('Test-Version');
abstract('Test version problem');
author('Mark Clements <badgersrc@cpan.org>');
version_from('lib/Test/Version.pm');
license('perl');
include('ExtUtils::AutoInstall');
requires(
version => 0,
);
auto_install();
&WriteAll;
mark:~/work/justice/tests/Module-Install$ cat lib/Test/Version.pm
package Test::Version;
use strict;
use warnings;
use version; our $VERSION = qv(1.2.0);
1;
mark:~/work/justice/tests/Module-Install$ perl Build.PL
include /home/mark/work/justice/tests/Module-Install/inc/Module/Install.pm
include inc/Module/Install/Metadata.pm
include inc/Module/Install/Base.pm
include inc/Module/Install/Include.pm
include inc/ExtUtils/AutoInstall.pm
include inc/Module/Install/AutoInstall.pm
include inc/Module/AutoInstall.pm
*** Module::AutoInstall version 1.020
*** Checking for Perl dependencies...
[Core Features]
- version ...loaded. (0.570)
*** Module::AutoInstall configuration finished.
include inc/Module/Install/Makefile.pm
include inc/Module/Install/WriteAll.pm
include inc/Module/Install/Win32.pm
include inc/Module/Install/Can.pm
include inc/Module/Install/Fetch.pm
include inc/Module/Install/Build.pm
Checking whether your kit is complete...
Looks good
Deleting Build
Removed previous script 'Build'
Creating new 'Build' script for 'Test-Version' version 'v1.2.0'
mark:~/work/justice/tests/Module-Install$ perl Build dist
Deleting META.yml
Couldn't load YAML.pm, generating a minimal META.yml without it.
Please check and edit the generated metadata, or consider installing
YAML.pm.
Creating Test-Version-version=HASH(0x838d4b4).tar.gz
tar cf Test-Version-version=HASH(0x838d4b4).tar
Test-Version-version=HASH(0x838d4b4)
gzip Test-Version-version=HASH(0x838d4b4).tar
gzip: Test-Version-version=HASH(0x838d4b4).tar.gz already exists; do you
wish to overwrite (y or n)? y
Deleting Test-Version-version=HASH(0x838d4b4)
mark:~/work/justice/tests/Module-Install$
mark:~/work/justice/tests/Module-Install$ cat showversion.pl
use strict;
use warnings;
use inc::Module::Install;
use Module::Build;
use version;
print "versions\n";
print "Module::Install $Module::Install::VERSION\n";
print "Module::Build $Module::Build::VERSION\n";
print "version $version::VERSION\n";
mark:~/work/justice/tests/Module-Install$ cat MB-Build.PL
use strict;
use warnings;
use Module::Build;
my $builder = Module::Build->new(
module_name => 'Test::Version',
license => 'perl',
dist_author => 'Mark Clements <badgersrc@cpan.org>',
dist_version_from => 'lib/Test/Version.pm',
requires => {
'version' => 0,
},
build_requires => { 'Module::Build' => 0,'Test::More' => 0, },
create_readme => 1,
);
$builder->create_build_script();
mark:~/work/justice/tests/Module-Install$ perl MB-Build.PL
Checking whether your kit is complete...
Looks good
Deleting Build
Removed previous script 'Build'
Creating new 'Build' script for 'Test-Version' version 'v1.2.0'
mark:~/work/justice/tests/Module-Install$ perl Build dist
Deleting META.yml
Couldn't load YAML.pm, generating a minimal META.yml without it.
Please check and edit the generated metadata, or consider installing
YAML.pm.
Use of uninitialized value in join or string at
/home/perl/lib/Module/Build/Base.pm line 2227.
Creating Test-Version-v1.2.0.tar.gz
tar cf Test-Version-v1.2.0.tar Test-Version-v1.2.0
gzip Test-Version-v1.2.0.tar
gzip: Test-Version-v1.2.0.tar.gz already exists; do you wish to
overwrite (y or n)? n
not overwritten
Deleting Test-Version-v1.2.0
mark:~/work/justice/tests/Module-Install$ perl showversion.pl
include /home/mark/work/justice/tests/Module-Install/inc/Module/Install.pm
versions
Module::Install 0.59
Module::Build 0.2611
version 0.57
Apologies for the rather long report. I hope it fully explains the issue.
regards,
Mark