Author: kwilliams
Date: Sun Aug 6 19:29:16 2006
New Revision: 6759
Modified:
Module-Build/trunk/Changes
Module-Build/trunk/lib/Module/Build/Base.pm
Module-Build/trunk/t/moduleinfo.t
Log:
Do a better job stringifying version objects for META.yml
Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes (original)
+++ Module-Build/trunk/Changes Sun Aug 6 19:29:16 2006
@@ -1,5 +1,13 @@
Revision history for Perl extension Module::Build.
+0.2806
+
+ - Because of a weird behavior of YAML::Node, any distribution that
+ used version.pm objects to define their versions was generating the
+ wrong syntax for the versions in their META.yml file. They will
+ now appear as strings like v3.42.1 or similar, including the
+ leading v.
+
0.2805 Sat Jul 29 22:01:24 CDT 2006
- We now embed a copy of version.pm right in the
Modified: Module-Build/trunk/lib/Module/Build/Base.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Base.pm (original)
+++ Module-Build/trunk/lib/Module/Build/Base.pm Sun Aug 6 19:29:16 2006
@@ -3384,9 +3384,9 @@
}
}
- # Stringify versions
- for (grep exists $_->{version}, values %prime) {
- $_->{version} = $_->{version}->stringify;
+ # Stringify versions. Can't use exists() here because of bug in YAML::Node.
+ for (grep defined $_->{version}, values %prime) {
+ $_->{version} = '' . $_->{version};
}
return \%prime;
Modified: Module-Build/trunk/t/moduleinfo.t
==============================================================================
--- Module-Build/trunk/t/moduleinfo.t (original)
+++ Module-Build/trunk/t/moduleinfo.t Sun Aug 6 19:29:16 2006
@@ -2,7 +2,7 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 75;
+use MBTest tests => 79;
use Cwd ();
my $cwd = Cwd::cwd;
@@ -386,7 +386,7 @@
{
- # examine properties of a module: name, pod, etc
+ # Make sure processing stops after __DATA__
$dist->change_file( 'lib/Simple.pm', <<'---' );
package Simple;
$VERSION = '0.01';
@@ -404,6 +404,24 @@
is_deeply([EMAIL PROTECTED], ['Simple']);
}
+{
+ # Make sure we handle version.pm $VERSIONs well
+ $dist->change_file( 'lib/Simple.pm', <<'---' );
+package Simple;
+$VERSION = version->new('0.60.' . qw$Revision$[1]);
+package Simple::Simon;
+$VERSION = version->new('0.61.' . qw$Revision$[1]);
+---
+ $dist->regen;
+
+ $pm_info = Module::Build::ModuleInfo->new_from_file('lib/Simple.pm');
+ is( $pm_info->name, 'Simple', 'found default package' );
+ is( $pm_info->version, 'v0.60.128', 'version for default package' );
+ my @packages = $pm_info->packages_inside;
+ is_deeply([sort @packages], ['Simple', 'Simple::Simon']);
+ is( $pm_info->version('Simple::Simon'), 'v0.61.129', 'version for embedded
package' );
+}
+
# cleanup
chdir( $cwd ) or die "Can't chdir to '$cwd': $!";