Fix for RT#47980

John Peacock <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.module-build
Message-ID <[email protected]>
Adam Kennedy opened a ticket against Module::Build, which David Golden correctly
interpreted as being version.pm's fault (in the pure Perl release only).  I've
committed a change (and test) that will be part of version-0.77.  The matching
fix needs to be applied to Module::Build's inline code.

John

=== lib/Module/Build/Version.pm
==================================================================
--- lib/Module/Build/Version.pm	(revision 2640)
+++ lib/Module/Build/Version.pm	(local)
@@ -628,15 +628,17 @@
     my $class = ref($obj) || $obj;

     no strict 'refs';
-    eval "require $class" unless %{"$class\::"}; # already existing
-    return undef if $@ =~ /Can't locate/ and not defined $req;
+    unless (%{"$class\::"}) { # class not already loaded
+    	eval "require $class";
+    	return undef if $@ =~ /Can't locate/ and not defined $req;
+    }

     if ( not %{"$class\::"} and $] >= 5.008) { # file but no package
 	require Carp;
 	Carp::croak( "$class defines neither package nor VERSION"
 	    ."--version check failed");
     }
-
+
     my $version = eval "\$$class\::VERSION";
     if ( defined $version ) {
 	local $^W if $] <= 5.008;
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.