[PATCH] Bring internal version class into line with current code

[email protected] (John Peacock)
Newsgroups perl.module.build
Message-ID <[email protected]>
Attached please find a patch to bring Module::Build's embedded version object
class into line with what will shortly be released to CPAN as 0.76.  The issue
that was noticed was distros like this:

http://www.cpan.org/pub/CPAN/authors/id/K/KR/KRUSCOE/Tie-DxHash-v1.0.0.meta

that don't have an "original" hash value would cause Perl 5.10.0 to segfault.

John
version-0.76.patch (text/x-patch, 893 B)
=== lib/Module/Build/Version.pm
==================================================================
--- lib/Module/Build/Version.pm	(revision 2222)
+++ lib/Module/Build/Version.pm	(local)
@@ -74,7 +74,7 @@
 
 use locale;
 use vars qw ($VERSION @ISA @REGEXS);
-$VERSION = 0.74;
+$VERSION = 0.76;
 
 push @REGEXS, qr/
 	^v?	# optional leading 'v'
@@ -426,7 +426,11 @@
 	require Carp;
 	Carp::croak("Invalid version object");
     }
-    return $self->{original};
+    return exists $self->{original} 
+    	? $self->{original} 
+	: exists $self->{qv} 
+	    ? $self->normal
+	    : $self->numify;
 }
 
 sub vcmp
@@ -557,7 +561,8 @@
 # Thanks to Yitzchak Scott-Thoennes for this mode of operation
 {
     local $^W;
-    *UNIVERSAL::VERSION = sub {
+    *UNIVERSAL::VERSION # Module::Build::ModuleInfo doesn't see this now
+      = sub {
 	my ($obj, $req) = @_;
 	my $class = ref($obj) || $obj;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.