Author: dagolden
Date: Mon Nov 23 19:17:26 2009
New Revision: 13588

Modified:
   Module-Build/trunk/Changes
   Module-Build/trunk/lib/Module/Build/ModuleInfo.pm

Log:
fix version parsing when VERSION comes from another module in lib

Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes  (original)
+++ Module-Build/trunk/Changes  Mon Nov 23 19:17:26 2009
@@ -13,6 +13,11 @@
  - Don't generate a MANIFEST.SKIP during distclean [reported by Zefram,
    fixed by David Golden]
 
+ - Module::Build::ModuleInfo version parsing would fail if a module sets
+   its $VERSION from another module, but the other module is not installed.
+   We now try to detect such failures, prepend 'lib' to @INC and try again.
+   [David Golden]
+
 0.35_09 - Thu Nov 19 01:30:42 EST 2009
 
  Bug fixes:

Modified: Module-Build/trunk/lib/Module/Build/ModuleInfo.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/ModuleInfo.pm   (original)
+++ Module-Build/trunk/lib/Module/Build/ModuleInfo.pm   Mon Nov 23 19:17:26 2009
@@ -321,6 +321,12 @@
   local $^W;
   # Try to get the $VERSION
   eval $eval;
+  # some modules say $VERSION = $Foo::Bar::VERSION, but Foo::Bar isn't
+  # installed, so we need to hunt in ./lib for it
+  if ( $@ =~ /Can't locate/ && -d 'lib' ) {
+    local @INC = ('lib',@INC);
+    eval $eval;
+  }
   warn "Error evaling version line '$eval' in $self->{filename}: $...@\n"
     if $@;
   (ref($vsub) eq 'CODE') or

Reply via email to