Update ExtUtils-MakeMaker to CPAN version 6.58
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Thu, 7 Jul 2011 10:04:30 +0000 (11:04 +0100)
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Thu, 7 Jul 2011 11:29:48 +0000 (12:29 +0100)
  [DELTA]

  6.58  Wed Jul  6 14:17:06 PDT 2011
    No changes since 6.57_11

  6.57_11  Thu May 19 17:26:31 PDT 2011
    Bug Fixes
    * Changed CPAN::Meta to accept version objects. [github #16]
    * Massage bad versions and warn the user about them. [github #15]
    * Protect against CPAN::Meta dying during metafile validation
      and generation.

    VMS
    * Fix prereq.t to work around "local %ENV = %ENV" bug

    Win32
    * Liblist::Kid can now recognize long compiler paths
      (Christian Walde) [github #11]

  6.57_10  Sun, 03 Apr 2011 19:36:38 +1000
    Bug Fixes
    * Relaxed strictures on prerequisite versions.  Invalid versions now
      issue a warning and are set to 0 rather than dying. [github #7]
    * Upgraded CPAN::Meta to 2.110930 which fixes a glitch in writing
      MYMETA.yml if your module's version number was 1.4. [github #9]
    * Convert LICENSE entries which are unknown to CPAN::Meta to
      "unknown" rather than dying. [github #10]

  6.57_09  Mon, 28 Mar 2011 11:13:39 +1100
    Misc
    * Make CPAN ignore bundled modules
    * Accidentally rolled Version::Requirements into the version bundle
    * Deleted now unused ExtUtils::MakeMaker::YAML

  6.57_08  Sun, 27 Mar 2011 21:52:47 +1100
    VMS
    * Removed dependency on cc_runtime.h for VMS as well.

    Misc
    * Changed how modules are bundled to avoid replacing XS version of
      Scalar::Util with a pure Perl version [github #4]

  6.57_07  Fri, 25 Mar 2011 14:31:31 +1100
    Enhancements
    * Generates META.json and MYMETA.json in addition to
      META.yml and MYMETA.yml (David Golden)
    * MYMETA has the runtime requirements made priority over META_*
      keys to allow generation of a correct META.* into the dist while
      still generating an accurate MYMETA.* locally (Matt S Trout)
    * Distributions should not depend on cc_runtime.h from core as it is
      only needed for B::CC
    * Now uses CPAN::Meta to generate META files.

    Bug Fixes
    * MYMETA.yml generation from META.yml actually works (Matt S Trout)
    * All required META fields are generated, even if they must be filled
      with "unknown" in place of real data (David Golden)

    Test Fixes
    * miniperl.t is no longer run outside of the perl core.  Its only relevant
      to bleadperl and requires no backwards compatibility [rt.cpan.org 61868]

    Cygwin
    * Rebase behaviour was improved (Reini Urban)
    * Build man pages (Reini Urban)

    Win32
    * Spot valid lib files on Win32 when .a and .lib are mixed.
      (Christian Walde) [github #3]
    * Extensive testing of ExtUtils::Liblist::Kid for Win32
      (Christian Walde)
    * Implemented proper emulation of DOS escaping rules in ExtUtils::MM_Win32
      (Christian Walde)

  6.57_06  Wed Oct 06 13:49:00 EEST 2010
    Win32
    * Work around dmake's limitations on how long a "line" can be.
      [rt.cpan.org 61286]
    * ActivePerl 1007 can now see gcc. [rt.cpan.org 55752] (Christian Walde)

    Bug Fixes
    * Fix for AUTHOR and undocumented usage of MM->new() (Alexandr Ciornii)

53 files changed:
MANIFEST
Porting/Maintainers.pl
cpan/CPAN-Meta/lib/CPAN/Meta.pm
cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm
cpan/ExtUtils-MakeMaker/Changes
cpan/ExtUtils-MakeMaker/MANIFEST
cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_AIX.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_BeOS.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_DOS.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Darwin.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_MacOS.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_NW5.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_OS2.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_QNX.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_UWIN.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VMS.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VOS.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win32.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win95.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MY.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Config.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/FAQ.pod
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Tutorial.pod
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/YAML.pm [deleted file]
cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mkbootstrap.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mksymlists.pm
cpan/ExtUtils-MakeMaker/lib/ExtUtils/testlib.pm
cpan/ExtUtils-MakeMaker/t/00compile.t
cpan/ExtUtils-MakeMaker/t/INST.t
cpan/ExtUtils-MakeMaker/t/INST_PREFIX.t
cpan/ExtUtils-MakeMaker/t/META_for_testing.json [new file with mode: 0644]
cpan/ExtUtils-MakeMaker/t/META_for_testing.yml [new file with mode: 0644]
cpan/ExtUtils-MakeMaker/t/META_for_testing_tricky_version.yml [new file with mode: 0644]
cpan/ExtUtils-MakeMaker/t/MM_Win32.t
cpan/ExtUtils-MakeMaker/t/basic.t
cpan/ExtUtils-MakeMaker/t/lib/MakeMaker/Test/Setup/SAS.pm
cpan/ExtUtils-MakeMaker/t/meta_convert.t [new file with mode: 0644]
cpan/ExtUtils-MakeMaker/t/metafile_data.t
cpan/ExtUtils-MakeMaker/t/min_perl_version.t
cpan/ExtUtils-MakeMaker/t/miniperl.t
cpan/ExtUtils-MakeMaker/t/oneliner.t
cpan/ExtUtils-MakeMaker/t/prereq.t
cpan/ExtUtils-MakeMaker/t/several_authors.t
cpan/ExtUtils-MakeMaker/t/writemakefile_args.t
pod/perldelta.pod

index 261535c..d48876e 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -965,7 +965,6 @@ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Config.pm    MakeMaker wrapper for C
 cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/FAQ.pod         MakeMaker FAQ
 cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm              Write Makefiles for extensions
 cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Tutorial.pod    Writing a module with MakeMaker
-cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/YAML.pm         clone of YAML::Tiny
 cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mkbootstrap.pm            Writes a bootstrap file (see MakeMaker)
 cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mksymlists.pm             Writes a linker options file for extensions
 cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_AIX.pm                 MakeMaker methods for AIX
@@ -1023,8 +1022,12 @@ cpan/ExtUtils-MakeMaker/t/lib/TieOut.pm                          Testing library to capture prints
 cpan/ExtUtils-MakeMaker/t/MakeMaker_Parameters.t               test "MakeMaker Parameters" section
 cpan/ExtUtils-MakeMaker/t/make.t                               See if make detection works
 cpan/ExtUtils-MakeMaker/t/maketext_filter.t                    See if maketext_filter works
+cpan/ExtUtils-MakeMaker/t/meta_convert.t                               See if MakeMaker works
 cpan/ExtUtils-MakeMaker/t/metafile_data.t                      See if META.yml handling works
 cpan/ExtUtils-MakeMaker/t/metafile_file.t                      See if META.yml handling works
+cpan/ExtUtils-MakeMaker/t/META_for_testing.json                                test data for MakeMaker
+cpan/ExtUtils-MakeMaker/t/META_for_testing_tricky_version.yml                          test data for MakeMaker
+cpan/ExtUtils-MakeMaker/t/META_for_testing.yml                         test data for MakeMaker
 cpan/ExtUtils-MakeMaker/t/miniperl.t                           Test MakeMaker with miniperl
 cpan/ExtUtils-MakeMaker/t/min_perl_version.t                   Test the MIN_PERL_VERSION argument to WriteMakefile.
 cpan/ExtUtils-MakeMaker/t/Mkbootstrap.t                                See if ExtUtils::Mkbootstrap works
index cd3557d..30a8e77 100755 (executable)
@@ -730,10 +730,12 @@ use File::Glob qw(:case);
     'ExtUtils::MakeMaker' =>
        {
        'MAINTAINER'    => 'mschwern',
-       'DISTRIBUTION'  => 'CHORNY/ExtUtils-MakeMaker-6.57_05.tar.gz',
+       'DISTRIBUTION'  => 'MSCHWERN/ExtUtils-MakeMaker-6.58.tar.gz',
        'FILES'         => q[cpan/ExtUtils-MakeMaker],
        'EXCLUDED'      => [ qr{^t/lib/Test/},
-                            qr{^inc/ExtUtils/},
+           qr{^(bundled|my)/},
+           qr{^t/Liblist_Kid.t},
+           qr{^t/liblist/},
                           ],
        'UPSTREAM'      => 'first-come',
        },
index 138aee3..5d53514 100644 (file)
@@ -3,7 +3,7 @@ use strict;
 use warnings;
 package CPAN::Meta;
 BEGIN {
-  $CPAN::Meta::VERSION = '2.110930';
+  $CPAN::Meta::VERSION = eval '2.110930_001';
 }
 # ABSTRACT: the distribution metadata for a CPAN dist
 
@@ -16,11 +16,7 @@ use CPAN::Meta::Validator;
 use Parse::CPAN::Meta 1.4400 ();
 
 sub _dclone {
-  my $ref = shift;
-  my $backend = Parse::CPAN::Meta->json_backend();
-  return $backend->new->decode(
-    $backend->new->convert_blessed->encode($ref)
-  );
+    CPAN::Meta::Converter::_dclone(@_);
 }
 
 
index 311a93d..2ea3456 100644 (file)
@@ -3,7 +3,7 @@ use strict;
 use warnings;
 package CPAN::Meta::Converter;
 BEGIN {
-  $CPAN::Meta::Converter::VERSION = '2.110930';
+  $CPAN::Meta::Converter::VERSION = eval '2.110930_001';
 }
 # ABSTRACT: Convert CPAN distribution metadata structures
 
@@ -11,15 +11,30 @@ BEGIN {
 use CPAN::Meta::Validator;
 use version 0.82 ();
 use Parse::CPAN::Meta 1.4400 ();
+use Carp qw(croak);
 
 sub _dclone {
   my $ref = shift;
+
+  # Work around JSON::PP's lack of a convert_blessed_universally
+  local *UNIVERSAL::TO_JSON = sub {
+      my $obj = shift;
+
+      # Special case: stringify version objects
+      # Everything else: serialize
+      return $obj->isa("version") ? "$obj"    :
+             $obj->isa("HASH")    ? { %$obj } :
+             $obj->isa("ARRAY")   ? { @$obj } :
+                                    croak "Don't know how to serialize $obj";
+  };
+
   my $backend = Parse::CPAN::Meta->json_backend();
   return $backend->new->decode(
-    $backend->new->convert_blessed->encode($ref)
+    $backend->new->convert_blessed->allow_blessed->encode($ref)
   );
 }
 
+
 my %known_specs = (
     '2'   => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec',
     '1.4' => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
index 8ac998f..e549e9c 100644 (file)
@@ -1,3 +1,90 @@
+6.58  Wed Jul  6 14:17:06 PDT 2011
+    No changes since 6.57_11
+
+
+6.57_11  Thu May 19 17:26:31 PDT 2011
+    Bug Fixes
+    * Changed CPAN::Meta to accept version objects. [github #16]
+    * Massage bad versions and warn the user about them. [github #15]
+    * Protect against CPAN::Meta dying during metafile validation
+      and generation.
+
+    VMS
+    * Fix prereq.t to work around "local %ENV = %ENV" bug
+
+    Win32
+    * Liblist::Kid can now recognize long compiler paths
+      (Christian Walde) [github #11]
+
+
+6.57_10  Sun, 03 Apr 2011 19:36:38 +1000
+    Bug Fixes
+    * Relaxed strictures on prerequisite versions.  Invalid versions now
+      issue a warning and are set to 0 rather than dying. [github #7]
+    * Upgraded CPAN::Meta to 2.110930 which fixes a glitch in writing
+      MYMETA.yml if your module's version number was 1.4. [github #9]
+    * Convert LICENSE entries which are unknown to CPAN::Meta to
+      "unknown" rather than dying. [github #10]
+
+
+6.57_09  Mon, 28 Mar 2011 11:13:39 +1100
+    Misc
+    * Make CPAN ignore bundled modules
+    * Accidentally rolled Version::Requirements into the version bundle
+    * Deleted now unused ExtUtils::MakeMaker::YAML
+
+
+6.57_08  Sun, 27 Mar 2011 21:52:47 +1100
+    VMS
+    * Removed dependency on cc_runtime.h for VMS as well.
+
+    Misc
+    * Changed how modules are bundled to avoid replacing XS version of
+      Scalar::Util with a pure Perl version [github #4]
+
+
+6.57_07  Fri, 25 Mar 2011 14:31:31 +1100
+    Enhancements
+    * Generates META.json and MYMETA.json in addition to
+      META.yml and MYMETA.yml (David Golden)
+    * MYMETA has the runtime requirements made priority over META_*
+      keys to allow generation of a correct META.* into the dist while
+      still generating an accurate MYMETA.* locally (Matt S Trout)
+    * Distributions should not depend on cc_runtime.h from core as it is
+      only needed for B::CC
+    * Now uses CPAN::Meta to generate META files.
+
+    Bug Fixes
+    * MYMETA.yml generation from META.yml actually works (Matt S Trout)
+    * All required META fields are generated, even if they must be filled
+      with "unknown" in place of real data (David Golden)
+
+    Test Fixes
+    * miniperl.t is no longer run outside of the perl core.  Its only relevant
+      to bleadperl and requires no backwards compatibility [rt.cpan.org 61868]
+
+    Cygwin
+    * Rebase behaviour was improved (Reini Urban)
+    * Build man pages (Reini Urban)
+
+    Win32
+    * Spot valid lib files on Win32 when .a and .lib are mixed.
+      (Christian Walde) [github #3]
+    * Extensive testing of ExtUtils::Liblist::Kid for Win32
+      (Christian Walde)
+    * Implemented proper emulation of DOS escaping rules in ExtUtils::MM_Win32
+      (Christian Walde)
+
+
+6.57_06  Wed Oct 06 13:49:00 EEST 2010
+    Win32
+    * Work around dmake's limitations on how long a "line" can be.
+      [rt.cpan.org 61286]
+    * ActivePerl 1007 can now see gcc. [rt.cpan.org 55752] (Christian Walde)
+
+    Bug Fixes
+    * Fix for AUTHOR and undocumented usage of MM->new() (Alexandr Ciornii)
+
 6.57_05  Sat Sep 11 23:24:00 EEST 2010
     Bug Fixes
     * AUTHOR compatibility code should also be called after CONFIGURE callback
 6.57_02  Wed Sep 08 02:40:00 EEST 2010
     Bug Fixes
     * Don't do MANIFEST checks in PERL_CORE (Robin Barker)
-
+    
     New Features
     * Accept several values (arrayref) in AUTHOR (Alexandr Ciornii)
     * Add MYMETA.yml support (Adam Kennedy, Alexandr Ciornii)
index 929765e..0f31fec 100644 (file)
@@ -1,12 +1,34 @@
-.gitignore
 bin/instmodsh
+bundled/CPAN-Meta-YAML/CPAN/Meta/YAML.pm
+bundled/CPAN-Meta/CPAN/Meta.pm
+bundled/CPAN-Meta/CPAN/Meta/Converter.pm
+bundled/CPAN-Meta/CPAN/Meta/Feature.pm
+bundled/CPAN-Meta/CPAN/Meta/History.pm
+bundled/CPAN-Meta/CPAN/Meta/Prereqs.pm
+bundled/CPAN-Meta/CPAN/Meta/Spec.pm
+bundled/CPAN-Meta/CPAN/Meta/Validator.pm
+bundled/ExtUtils-Command/ExtUtils/Command.pm
+bundled/ExtUtils-Install/ExtUtils/Install.pm
+bundled/ExtUtils-Install/ExtUtils/Installed.pm
+bundled/ExtUtils-Install/ExtUtils/Packlist.pm
+bundled/ExtUtils-Manifest/ExtUtils/Manifest.pm
+bundled/ExtUtils-Manifest/ExtUtils/MANIFEST.SKIP
+bundled/File-Copy-Recursive/File/Copy/Recursive.pm
+bundled/File-Temp/File/Temp.pm
+bundled/JSON-PP-Compat5006/JSON/PP/Compat5006.pm
+bundled/JSON-PP/JSON/PP.pm
+bundled/JSON-PP/JSON/PP/Boolean.pm
+bundled/Parse-CPAN-Meta/Parse/CPAN/Meta.pm
+bundled/Scalar-List-Utils/List/Util.pm
+bundled/Scalar-List-Utils/List/Util/PP.pm
+bundled/Scalar-List-Utils/Scalar/Util.pm
+bundled/Scalar-List-Utils/Scalar/Util/PP.pm
+bundled/Version-Requirements/Version/Requirements.pm
+bundled/version/version.pm
+bundled/version/version.pod
+bundled/version/version/Internals.pod
+bundled/version/version/vpp.pm
 Changes
-inc/ExtUtils/Command.pm
-inc/ExtUtils/Install.pm
-inc/ExtUtils/Installed.pm
-inc/ExtUtils/Manifest.pm
-inc/ExtUtils/MANIFEST.SKIP
-inc/ExtUtils/Packlist.pm
 INSTALL
 lib/ExtUtils/Command/MM.pm
 lib/ExtUtils/Liblist.pm
@@ -15,7 +37,6 @@ lib/ExtUtils/MakeMaker.pm
 lib/ExtUtils/MakeMaker/Config.pm
 lib/ExtUtils/MakeMaker/FAQ.pod
 lib/ExtUtils/MakeMaker/Tutorial.pod
-lib/ExtUtils/MakeMaker/YAML.pm
 lib/ExtUtils/Mkbootstrap.pm
 lib/ExtUtils/Mksymlists.pm
 lib/ExtUtils/MM.pm
@@ -40,6 +61,7 @@ lib/ExtUtils/testlib.pm
 Makefile.PL
 MANIFEST                       This list of files
 MANIFEST.SKIP
+my/bundles.pm
 NOTES
 PATCHING
 README
@@ -77,9 +99,30 @@ t/lib/Test/Simple.pm
 t/lib/TieIn.pm
 t/lib/TieOut.pm
 t/Liblist.t
+t/liblist/win32/__test.lib
+'t/liblist/win32/di r/dir_test.lib'
+t/liblist/win32/dir/dir_test.lib
+t/liblist/win32/double.lib
+t/liblist/win32/lib/CORE/c_test.lib
+t/liblist/win32/lib/CORE/double.lib
+t/liblist/win32/lib__test.lib
+t/liblist/win32/lib_test.lib
+t/liblist/win32/libpath/lp_test.lib
+t/liblist/win32/pl.lib
+'t/liblist/win32/space lib.lib'
+t/liblist/win32/test.a.lib
+t/liblist/win32/test.lib
+t/liblist/win32/test.meep
+t/liblist/win32/test2.lib
+t/liblist/win32/vc/vctest.lib
+t/Liblist_Kid.t
 t/make.t
 t/MakeMaker_Parameters.t
 t/maketext_filter.t
+t/meta_convert.t
+t/META_for_testing.json
+t/META_for_testing.yml
+t/META_for_testing_tricky_version.yml
 t/metafile_data.t
 t/metafile_file.t
 t/min_perl_version.t
@@ -119,4 +162,6 @@ t/WriteEmptyMakefile.t
 t/writemakefile_args.t
 t/xs.t
 TODO
-META.yml                                 Module meta-data (added by MakeMaker)
+META.yml                                 Module YAML meta-data (added by MakeMaker)
+META.json                                Module JSON meta-data (added by MakeMaker)
+SIGNATURE                                Public-key signature (added by MakeMaker)
index 40bf780..5a33bff 100644 (file)
@@ -8,9 +8,9 @@ use warnings;
 require Exporter;
 our @ISA = qw(Exporter);
 
-our @EXPORT  = qw(test_harness pod2man perllocal_install uninstall
+our @EXPORT  = qw(test_harness pod2man perllocal_install uninstall 
                   warn_if_old_packlist);
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 my $Is_VMS = $^O eq 'VMS';
 
index 2184c4a..a4e2666 100644 (file)
@@ -2,7 +2,7 @@ package ExtUtils::Liblist;
 
 use strict;
 
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 use File::Spec;
 require ExtUtils::Liblist::Kid;
index cf4826f..a0e2f24 100644 (file)
@@ -6,214 +6,241 @@ package ExtUtils::Liblist::Kid;
 # $self is not a Makemaker.
 
 use 5.006;
+
 # Broken out of MakeMaker from version 4.11
 
 use strict;
-our $VERSION = 6.57_05;
+use warnings;
+our $VERSION = '6.58';
 
-use Config;
+use ExtUtils::MakeMaker::Config;
 use Cwd 'cwd';
 use File::Basename;
 use File::Spec;
 
 sub ext {
-  if   ($^O eq 'VMS')     { return &_vms_ext;      }
-  elsif($^O eq 'MSWin32') { return &_win32_ext;    }
-  else                    { return &_unix_os2_ext; }
+    if    ( $^O eq 'VMS' )     { return &_vms_ext; }
+    elsif ( $^O eq 'MSWin32' ) { return &_win32_ext; }
+    else                       { return &_unix_os2_ext; }
 }
 
 sub _unix_os2_ext {
-    my($self,$potential_libs, $verbose, $give_libs) = @_;
+    my ( $self, $potential_libs, $verbose, $give_libs ) = @_;
     $verbose ||= 0;
 
-    if ($^O =~ 'os2' and $Config{perllibs}) { 
-       # Dynamic libraries are not transitive, so we may need including
-       # the libraries linked against perl.dll again.
+    if ( $^O =~ 'os2' and $Config{perllibs} ) {
+
+        # Dynamic libraries are not transitive, so we may need including
+        # the libraries linked against perl.dll again.
 
-       $potential_libs .= " " if $potential_libs;
-       $potential_libs .= $Config{perllibs};
+        $potential_libs .= " " if $potential_libs;
+        $potential_libs .= $Config{perllibs};
     }
-    return ("", "", "", "", ($give_libs ? [] : ())) unless $potential_libs;
+    return ( "", "", "", "", ( $give_libs ? [] : () ) ) unless $potential_libs;
     warn "Potential libraries are '$potential_libs':\n" if $verbose;
 
-    my($so)   = $Config{so};
-    my($libs) = defined $Config{perllibs} ? $Config{perllibs} : $Config{libs};
+    my ( $so ) = $Config{so};
+    my ( $libs ) = defined $Config{perllibs} ? $Config{perllibs} : $Config{libs};
     my $Config_libext = $Config{lib_ext} || ".a";
     my $Config_dlext = $Config{dlext};
 
-
     # compute $extralibs, $bsloadlibs and $ldloadlibs from
     # $potential_libs
     # this is a rewrite of Andy Dougherty's extliblist in perl
 
-    my(@searchpath); # from "-L/path" entries in $potential_libs
-    my(@libpath) = split " ", $Config{'libpth'};
-    my(@ldloadlibs, @bsloadlibs, @extralibs, @ld_run_path, %ld_run_path_seen);
-    my(@libs, %libs_seen);
-    my($fullname, @fullname);
-    my($pwd) = cwd(); # from Cwd.pm
-    my($found) = 0;
-
-    foreach my $thislib (split ' ', $potential_libs) {
-
-       # Handle possible linker path arguments.
-       if ($thislib =~ s/^(-[LR]|-Wl,-R)//){   # save path flag type
-           my($ptype) = $1;
-           unless (-d $thislib){
-               warn "$ptype$thislib ignored, directory does not exist\n"
-                       if $verbose;
-               next;
-           }
-           my($rtype) = $ptype;
-           if (($ptype eq '-R') or ($ptype eq '-Wl,-R')) {
-               if ($Config{'lddlflags'} =~ /-Wl,-R/) {
-                   $rtype = '-Wl,-R';
-               } elsif ($Config{'lddlflags'} =~ /-R/) {
-                   $rtype = '-R';
-               }
-           }
-           unless (File::Spec->file_name_is_absolute($thislib)) {
-             warn "Warning: $ptype$thislib changed to $ptype$pwd/$thislib\n";
-             $thislib = $self->catdir($pwd,$thislib);
-           }
-           push(@searchpath, $thislib);
-           push(@extralibs,  "$ptype$thislib");
-           push(@ldloadlibs, "$rtype$thislib");
-           next;
-       }
-
-       # Handle possible library arguments.
-       unless ($thislib =~ s/^-l//){
-         warn "Unrecognized argument in LIBS ignored: '$thislib'\n";
-         next;
-       }
-
-       my($found_lib)=0;
-       foreach my $thispth (@searchpath, @libpath) {
-
-               # Try to find the full name of the library.  We need this to
-               # determine whether it's a dynamically-loadable library or not.
-               # This tends to be subject to various os-specific quirks.
-               # For gcc-2.6.2 on linux (March 1995), DLD can not load
-               # .sa libraries, with the exception of libm.sa, so we
-               # deliberately skip them.
-           if (@fullname =
-                   $self->lsdir($thispth,"^\Qlib$thislib.$so.\E[0-9]+")){
-               # Take care that libfoo.so.10 wins against libfoo.so.9.
-               # Compare two libraries to find the most recent version
-               # number.  E.g.  if you have libfoo.so.9.0.7 and
-               # libfoo.so.10.1, first convert all digits into two
-               # decimal places.  Then we'll add ".00" to the shorter
-               # strings so that we're comparing strings of equal length
-               # Thus we'll compare libfoo.so.09.07.00 with
-               # libfoo.so.10.01.00.  Some libraries might have letters
-               # in the version.  We don't know what they mean, but will
-               # try to skip them gracefully -- we'll set any letter to
-               # '0'.  Finally, sort in reverse so we can take the
-               # first element.
-
-               #TODO: iterate through the directory instead of sorting
-
-               $fullname = "$thispth/" .
-               (sort { my($ma) = $a;
-                       my($mb) = $b;
-                       $ma =~ tr/A-Za-z/0/s;
-                       $ma =~ s/\b(\d)\b/0$1/g;
-                       $mb =~ tr/A-Za-z/0/s;
-                       $mb =~ s/\b(\d)\b/0$1/g;
-                       while (length($ma) < length($mb)) { $ma .= ".00"; }
-                       while (length($mb) < length($ma)) { $mb .= ".00"; }
-                       # Comparison deliberately backwards
-                       $mb cmp $ma;} @fullname)[0];
-           } elsif (-f ($fullname="$thispth/lib$thislib.$so")
-                && (($Config{'dlsrc'} ne "dl_dld.xs") || ($thislib eq "m"))){
-           } elsif (-f ($fullname="$thispth/lib${thislib}_s$Config_libext")
-                 && ($Config{'archname'} !~ /RM\d\d\d-svr4/)
-                && ($thislib .= "_s") ){ # we must explicitly use _s version
-           } elsif (-f ($fullname="$thispth/lib$thislib$Config_libext")){
-           } elsif (defined($Config_dlext)
-                 && -f ($fullname="$thispth/lib$thislib.$Config_dlext")){
-           } elsif (-f ($fullname="$thispth/$thislib$Config_libext")){
-           } elsif (-f ($fullname="$thispth/lib$thislib.dll$Config_libext")){
-           } elsif (-f ($fullname="$thispth/Slib$thislib$Config_libext")){
-           } elsif ($^O eq 'dgux'
-                && -l ($fullname="$thispth/lib$thislib$Config_libext")
-                && readlink($fullname) =~ /^elink:/s) {
-                # Some of DG's libraries look like misconnected symbolic
-                # links, but development tools can follow them.  (They
-                # look like this:
-                #
-                #    libm.a -> elink:${SDE_PATH:-/usr}/sde/\
-                #    ${TARGET_BINARY_INTERFACE:-m88kdgux}/usr/lib/libm.a
-                #
-                # , the compilation tools expand the environment variables.)
-           } else {
-               warn "$thislib not found in $thispth\n" if $verbose;
-               next;
-           }
-           warn "'-l$thislib' found at $fullname\n" if $verbose;
-           push @libs, $fullname unless $libs_seen{$fullname}++;
-           $found++;
-           $found_lib++;
-
-           # Now update library lists
-
-           # what do we know about this library...
-           my $is_dyna = ($fullname !~ /\Q$Config_libext\E\z/);
-           my $in_perl = ($libs =~ /\B-l\Q${thislib}\E\b/s);
+    my ( @searchpath );    # from "-L/path" entries in $potential_libs
+    my ( @libpath ) = split " ", $Config{'libpth'};
+    my ( @ldloadlibs, @bsloadlibs, @extralibs, @ld_run_path, %ld_run_path_seen );
+    my ( @libs,       %libs_seen );
+    my ( $fullname,   @fullname );
+    my ( $pwd )   = cwd();    # from Cwd.pm
+    my ( $found ) = 0;
+
+    foreach my $thislib ( split ' ', $potential_libs ) {
+
+        # Handle possible linker path arguments.
+        if ( $thislib =~ s/^(-[LR]|-Wl,-R)// ) {    # save path flag type
+            my ( $ptype ) = $1;
+            unless ( -d $thislib ) {
+                warn "$ptype$thislib ignored, directory does not exist\n"
+                  if $verbose;
+                next;
+            }
+            my ( $rtype ) = $ptype;
+            if ( ( $ptype eq '-R' ) or ( $ptype eq '-Wl,-R' ) ) {
+                if ( $Config{'lddlflags'} =~ /-Wl,-R/ ) {
+                    $rtype = '-Wl,-R';
+                }
+                elsif ( $Config{'lddlflags'} =~ /-R/ ) {
+                    $rtype = '-R';
+                }
+            }
+            unless ( File::Spec->file_name_is_absolute( $thislib ) ) {
+                warn "Warning: $ptype$thislib changed to $ptype$pwd/$thislib\n";
+                $thislib = $self->catdir( $pwd, $thislib );
+            }
+            push( @searchpath, $thislib );
+            push( @extralibs,  "$ptype$thislib" );
+            push( @ldloadlibs, "$rtype$thislib" );
+            next;
+        }
+
+        # Handle possible library arguments.
+        unless ( $thislib =~ s/^-l// ) {
+            warn "Unrecognized argument in LIBS ignored: '$thislib'\n";
+            next;
+        }
+
+        my ( $found_lib ) = 0;
+        foreach my $thispth ( @searchpath, @libpath ) {
+
+            # Try to find the full name of the library.  We need this to
+            # determine whether it's a dynamically-loadable library or not.
+            # This tends to be subject to various os-specific quirks.
+            # For gcc-2.6.2 on linux (March 1995), DLD can not load
+            # .sa libraries, with the exception of libm.sa, so we
+            # deliberately skip them.
+            if ( @fullname = $self->lsdir( $thispth, "^\Qlib$thislib.$so.\E[0-9]+" ) ) {
+
+                # Take care that libfoo.so.10 wins against libfoo.so.9.
+                # Compare two libraries to find the most recent version
+                # number.  E.g.  if you have libfoo.so.9.0.7 and
+                # libfoo.so.10.1, first convert all digits into two
+                # decimal places.  Then we'll add ".00" to the shorter
+                # strings so that we're comparing strings of equal length
+                # Thus we'll compare libfoo.so.09.07.00 with
+                # libfoo.so.10.01.00.  Some libraries might have letters
+                # in the version.  We don't know what they mean, but will
+                # try to skip them gracefully -- we'll set any letter to
+                # '0'.  Finally, sort in reverse so we can take the
+                # first element.
+
+                #TODO: iterate through the directory instead of sorting
+
+                $fullname = "$thispth/" . (
+                    sort {
+                        my ( $ma ) = $a;
+                        my ( $mb ) = $b;
+                        $ma =~ tr/A-Za-z/0/s;
+                        $ma =~ s/\b(\d)\b/0$1/g;
+                        $mb =~ tr/A-Za-z/0/s;
+                        $mb =~ s/\b(\d)\b/0$1/g;
+                        while ( length( $ma ) < length( $mb ) ) { $ma .= ".00"; }
+                        while ( length( $mb ) < length( $ma ) ) { $mb .= ".00"; }
+
+                        # Comparison deliberately backwards
+                        $mb cmp $ma;
+                      } @fullname
+                )[0];
+            }
+            elsif ( -f ( $fullname = "$thispth/lib$thislib.$so" )
+                && ( ( $Config{'dlsrc'} ne "dl_dld.xs" ) || ( $thislib eq "m" ) ) )
+            {
+            }
+            elsif (-f ( $fullname = "$thispth/lib${thislib}_s$Config_libext" )
+                && ( $Config{'archname'} !~ /RM\d\d\d-svr4/ )
+                && ( $thislib .= "_s" ) )
+            {    # we must explicitly use _s version
+            }
+            elsif ( -f ( $fullname = "$thispth/lib$thislib$Config_libext" ) ) {
+            }
+            elsif ( defined( $Config_dlext )
+                && -f ( $fullname = "$thispth/lib$thislib.$Config_dlext" ) )
+            {
+            }
+            elsif ( -f ( $fullname = "$thispth/$thislib$Config_libext" ) ) {
+            }
+            elsif ( -f ( $fullname = "$thispth/lib$thislib.dll$Config_libext" ) ) {
+            }
+            elsif ( -f ( $fullname = "$thispth/Slib$thislib$Config_libext" ) ) {
+            }
+            elsif ($^O eq 'dgux'
+                && -l ( $fullname = "$thispth/lib$thislib$Config_libext" )
+                && readlink( $fullname ) =~ /^elink:/s )
+            {
+
+                # Some of DG's libraries look like misconnected symbolic
+                # links, but development tools can follow them.  (They
+                # look like this:
+                #
+                #    libm.a -> elink:${SDE_PATH:-/usr}/sde/\
+                #    ${TARGET_BINARY_INTERFACE:-m88kdgux}/usr/lib/libm.a
+                #
+                # , the compilation tools expand the environment variables.)
+            }
+            else {
+                warn "$thislib not found in $thispth\n" if $verbose;
+                next;
+            }
+            warn "'-l$thislib' found at $fullname\n" if $verbose;
+            push @libs, $fullname unless $libs_seen{$fullname}++;
+            $found++;
+            $found_lib++;
+
+            # Now update library lists
+
+            # what do we know about this library...
+            my $is_dyna = ( $fullname !~ /\Q$Config_libext\E\z/ );
+            my $in_perl = ( $libs =~ /\B-l\Q${thislib}\E\b/s );
 
             # include the path to the lib once in the dynamic linker path
             # but only if it is a dynamic lib and not in Perl itself
-            my($fullnamedir) = dirname($fullname);
+            my ( $fullnamedir ) = dirname( $fullname );
             push @ld_run_path, $fullnamedir
-                 if $is_dyna && !$in_perl &&
-                    !$ld_run_path_seen{$fullnamedir}++;
-
-           # Do not add it into the list if it is already linked in
-           # with the main perl executable.
-           # We have to special-case the NeXT, because math and ndbm 
-           # are both in libsys_s
-           unless ($in_perl || 
-               ($Config{'osname'} eq 'next' &&
-                   ($thislib eq 'm' || $thislib eq 'ndbm')) ){
-               push(@extralibs, "-l$thislib");
-           }
-
-           # We might be able to load this archive file dynamically
-           if ( ($Config{'dlsrc'} =~ /dl_next/ && $Config{'osvers'} lt '4_0')
-           ||   ($Config{'dlsrc'} =~ /dl_dld/) )
-           {
-               # We push -l$thislib instead of $fullname because
-               # it avoids hardwiring a fixed path into the .bs file.
-               # Mkbootstrap will automatically add dl_findfile() to
-               # the .bs file if it sees a name in the -l format.
-               # USE THIS, when dl_findfile() is fixed: 
-               # push(@bsloadlibs, "-l$thislib");
-               # OLD USE WAS while checking results against old_extliblist
-               push(@bsloadlibs, "$fullname");
-           } else {
-               if ($is_dyna){
+              if $is_dyna
+                  && !$in_perl
+                  && !$ld_run_path_seen{$fullnamedir}++;
+
+            # Do not add it into the list if it is already linked in
+            # with the main perl executable.
+            # We have to special-case the NeXT, because math and ndbm
+            # are both in libsys_s
+            unless (
+                $in_perl
+                || ( $Config{'osname'} eq 'next'
+                    && ( $thislib eq 'm' || $thislib eq 'ndbm' ) )
+              )
+            {
+                push( @extralibs, "-l$thislib" );
+            }
+
+            # We might be able to load this archive file dynamically
+            if (   ( $Config{'dlsrc'} =~ /dl_next/ && $Config{'osvers'} lt '4_0' )
+                || ( $Config{'dlsrc'} =~ /dl_dld/ ) )
+            {
+
+                # We push -l$thislib instead of $fullname because
+                # it avoids hardwiring a fixed path into the .bs file.
+                # Mkbootstrap will automatically add dl_findfile() to
+                # the .bs file if it sees a name in the -l format.
+                # USE THIS, when dl_findfile() is fixed:
+                # push(@bsloadlibs, "-l$thislib");
+                # OLD USE WAS while checking results against old_extliblist
+                push( @bsloadlibs, "$fullname" );
+            }
+            else {
+                if ( $is_dyna ) {
+
                     # For SunOS4, do not add in this shared library if
                     # it is already linked in the main perl executable
-                   push(@ldloadlibs, "-l$thislib")
-                       unless ($in_perl and $^O eq 'sunos');
-               } else {
-                   push(@ldloadlibs, "-l$thislib");
-               }
-           }
-           last;       # found one here so don't bother looking further
-       }
-       warn "Note (probably harmless): "
-                    ."No library found for -l$thislib\n"
-           unless $found_lib>0;
+                    push( @ldloadlibs, "-l$thislib" )
+                      unless ( $in_perl and $^O eq 'sunos' );
+                }
+                else {
+                    push( @ldloadlibs, "-l$thislib" );
+                }
+            }
+            last;    # found one here so don't bother looking further
+        }
+        warn "Note (probably harmless): " . "No library found for -l$thislib\n"
+          unless $found_lib > 0;
     }
 
-    unless( $found ) {
-        return ('','','','', ($give_libs ? \@libs : ()));
+    unless ( $found ) {
+        return ( '', '', '', '', ( $give_libs ? \@libs : () ) );
     }
     else {
-        return ("@extralibs", "@bsloadlibs", "@ldloadlibs",
-                join(":",@ld_run_path), ($give_libs ? \@libs : ()));
+        return ( "@extralibs", "@bsloadlibs", "@ldloadlibs", join( ":", @ld_run_path ), ( $give_libs ? \@libs : () ) );
     }
 }
 
@@ -221,329 +248,378 @@ sub _win32_ext {
 
     require Text::ParseWords;
 
-    my($self, $potential_libs, $verbose, $give_libs) = @_;
+    my ( $self, $potential_libs, $verbose, $give_libs ) = @_;
     $verbose ||= 0;
 
     # If user did not supply a list, we punt.
     # (caller should probably use the list in $Config{libs})
-    return ("", "", "", "", ($give_libs ? [] : ())) unless $potential_libs;
-
-    my $cc             = $Config{cc};
-    my $VC             = $cc =~ /^cl/i;
-    my $BC             = $cc =~ /^bcc/i;
-    my $GC             = $cc =~ /^gcc/i;
-    my $so             = $Config{'so'};
-    my $libs           = $Config{'perllibs'};
-    my $libpth         = $Config{'libpth'};
-    my $libext         = $Config{'lib_ext'} || ".lib";
-    my(@libs, %libs_seen);
-
-    if ($libs and $potential_libs !~ /:nodefault/i) { 
-       # If Config.pm defines a set of default libs, we always
-       # tack them on to the user-supplied list, unless the user
-       # specified :nodefault
-
-       $potential_libs .= " " if $potential_libs;
-       $potential_libs .= $libs;
-    }
-    warn "Potential libraries are '$potential_libs':\n" if $verbose;
+    return ( "", "", "", "", ( $give_libs ? [] : () ) ) unless $potential_libs;
 
-    # normalize to forward slashes
-    $libpth =~ s,\\,/,g;
-    $potential_libs =~ s,\\,/,g;
+    # TODO: make this use MM_Win32.pm's compiler detection
+    my %libs_seen;
+    my @extralibs;
+    my $cc         = $Config{cc} || '';
+    my $VC         = $cc =~ /\bcl\b/i;
+    my $GC         = $cc =~ /\bgcc\b/i;
+    my $libext     = _win32_lib_extensions();
+    my @searchpath = ( '' );                               # from "-L/path" entries in $potential_libs
+    my @libpath    = _win32_default_search_paths( $VC );
+    my $pwd        = cwd();                                # from Cwd.pm
+    my $search     = 1;
 
-    # compute $extralibs from $potential_libs
+    # compute @extralibs from $potential_libs
+    my @lib_search_list = _win32_make_lib_search_list( $potential_libs, $verbose );
+    for ( @lib_search_list ) {
 
-    my @searchpath;                # from "-L/path" in $potential_libs
-    my @libpath                = Text::ParseWords::quotewords('\s+', 0, $libpth);
-    my @extralibs;
-    my $pwd            = cwd();    # from Cwd.pm
-    my $lib            = '';
-    my $found          = 0;
-    my $search         = 1;
-    my($fullname);
+        my $thislib = $_;
 
-    # add "$Config{installarchlib}/CORE" to default search path
-    push @libpath, "$Config{installarchlib}/CORE";
+        # see if entry is a flag
+        if ( /^:\w+$/ ) {
+            $search = 0 if lc eq ':nosearch';
+            $search = 1 if lc eq ':search';
+            _debug( "Ignoring unknown flag '$thislib'\n", $verbose ) if !/^:(no)?(search|default)$/i;
+            next;
+        }
 
-    if ($VC and exists $ENV{LIB} and $ENV{LIB}) {
-        push @libpath, split /;/, $ENV{LIB};
-    }
+        # if searching is disabled, do compiler-specific translations
+        unless ( $search ) {
+            s/^-l(.+)$/$1.lib/ unless $GC;
+            s/^-L/-libpath:/ if $VC;
+            push( @extralibs, $_ );
+            next;
+        }
 
-    foreach (Text::ParseWords::quotewords('\s+', 0, $potential_libs)){
+        # handle possible linker path arguments
+        if ( s/^-L// and not -d ) {
+            _debug( "$thislib ignored, directory does not exist\n", $verbose );
+            next;
+        }
+        elsif ( -d ) {
+            unless ( File::Spec->file_name_is_absolute( $_ ) ) {
+                warn "Warning: '$thislib' changed to '-L$pwd/$_'\n";
+                $_ = $self->catdir( $pwd, $_ );
+            }
+            push( @searchpath, $_ );
+            next;
+        }
 
-       my $thislib = $_;
+        my @paths = ( @searchpath, @libpath );
+        my ( $fullname, $path ) = _win32_search_file( $thislib, $libext, \@paths, $verbose, $GC );
 
-        # see if entry is a flag
-       if (/^:\w+$/) {
-           $search     = 0 if lc eq ':nosearch';
-           $search     = 1 if lc eq ':search';
-           warn "Ignoring unknown flag '$thislib'\n"
-               if $verbose and !/^:(no)?(search|default)$/i;
-           next;
-       }
-
-       # if searching is disabled, do compiler-specific translations
-       unless ($search) {
-           s/^-l(.+)$/$1.lib/ unless $GC;
-           s/^-L/-libpath:/ if $VC;
-           push(@extralibs, $_);
-           $found++;
-           next;
-       }
-
-       # handle possible linker path arguments
-       if (s/^-L// and not -d) {
-           warn "$thislib ignored, directory does not exist\n"
-               if $verbose;
-           next;
-       }
-       elsif (-d) {
-           unless (File::Spec->file_name_is_absolute($_)) {
-             warn "Warning: '$thislib' changed to '-L$pwd/$_'\n";
-             $_ = $self->catdir($pwd,$_);
-           }
-           push(@searchpath, $_);
-           next;
-       }
-
-       # handle possible library arguments
-       if (s/^-l// and $GC and !/^lib/i) {
-           $_ = "lib$_";
-       }
-       $_ .= $libext if !/\Q$libext\E$/i;
-
-       my $secondpass = 0;
-    LOOKAGAIN:
-
-        # look for the file itself
-       if (-f) {
-           warn "'$thislib' found as '$_'\n" if $verbose;
-           $found++;
-           push(@extralibs, $_);
-           next;
-       }
-
-       my $found_lib = 0;
-       foreach my $thispth (@searchpath, @libpath){
-           unless (-f ($fullname="$thispth\\$_")) {
-               warn "'$thislib' not found as '$fullname'\n" if $verbose;
-               next;
-           }
-           warn "'$thislib' found as '$fullname'\n" if $verbose;
-           $found++;
-           $found_lib++;
-           push(@extralibs, $fullname);
-           push @libs, $fullname unless $libs_seen{$fullname}++;
-           last;
-       }
-
-       # do another pass with (or without) leading 'lib' if they used -l
-       if (!$found_lib and $thislib =~ /^-l/ and !$secondpass++) {
-           if ($GC) {
-               goto LOOKAGAIN if s/^lib//i;
-           }
-           elsif (!/^lib/i) {
-               $_ = "lib$_";
-               goto LOOKAGAIN;
-           }
-       }
-
-       # give up
-       warn "Note (probably harmless): "
-                    ."No library found for $thislib\n"
-           unless $found_lib>0;
+        if ( !$fullname ) {
+            warn "Note (probably harmless): No library found for $thislib\n";
+            next;
+        }
 
+        _debug( "'$thislib' found as '$fullname'\n", $verbose );
+        push( @extralibs, $fullname );
+        $libs_seen{$fullname} = 1 if $path;    # why is this a special case?
     }
 
-    return ('','','','', ($give_libs ? \@libs : ())) unless $found;
+    my @libs = keys %libs_seen;
+
+    return ( '', '', '', '', ( $give_libs ? \@libs : () ) ) unless @extralibs;
 
     # make sure paths with spaces are properly quoted
-    @extralibs = map { (/\s/ && !/^".*"$/) ? qq["$_"] : $_ } @extralibs;
-    @libs = map { (/\s/ && !/^".*"$/) ? qq["$_"] : $_ } @libs;
-    $lib = join(' ',@extralibs);
+    @extralibs = map { /\s/ ? qq["$_"] : $_ } @extralibs;
+    @libs      = map { /\s/ ? qq["$_"] : $_ } @libs;
+
+    my $lib = join( ' ', @extralibs );
 
     # normalize back to backward slashes (to help braindead tools)
     # XXX this may break equally braindead GNU tools that don't understand
     # backslashes, either.  Seems like one can't win here.  Cursed be CP/M.
     $lib =~ s,/,\\,g;
 
-    warn "Result: $lib\n" if $verbose;
-    wantarray ? ($lib, '', $lib, '', ($give_libs ? \@libs : ())) : $lib;
+    _debug( "Result: $lib\n", $verbose );
+    wantarray ? ( $lib, '', $lib, '', ( $give_libs ? \@libs : () ) ) : $lib;
 }
 
+sub _win32_make_lib_search_list {
+    my ( $potential_libs, $verbose ) = @_;
 
-sub _vms_ext {
-  my($self, $potential_libs, $verbose, $give_libs) = @_;
-  $verbose ||= 0;
-
-  my(@crtls,$crtlstr);
-  @crtls = ( ($Config{'ldflags'} =~ m-/Debug-i ? $Config{'dbgprefix'} : '')
-              . 'PerlShr/Share' );
-  push(@crtls, grep { not /\(/ } split /\s+/, $Config{'perllibs'});
-  push(@crtls, grep { not /\(/ } split /\s+/, $Config{'libc'});
-  # In general, we pass through the basic libraries from %Config unchanged.
-  # The one exception is that if we're building in the Perl source tree, and
-  # a library spec could be resolved via a logical name, we go to some trouble
-  # to insure that the copy in the local tree is used, rather than one to
-  # which a system-wide logical may point.
-  if ($self->{PERL_SRC}) {
-    my($locspec,$type);
-    foreach my $lib (@crtls) { 
-      if (($locspec,$type) = $lib =~ m{^([\w\$-]+)(/\w+)?} and $locspec =~ /perl/i) {
-        if    (lc $type eq '/share')   { $locspec .= $Config{'exe_ext'}; }
-        elsif (lc $type eq '/library') { $locspec .= $Config{'lib_ext'}; }
-        else                           { $locspec .= $Config{'obj_ext'}; }
-        $locspec = $self->catfile($self->{PERL_SRC},$locspec);
-        $lib = "$locspec$type" if -e $locspec;
-      }
-    }
-  }
-  $crtlstr = @crtls ? join(' ',@crtls) : '';
-
-  unless ($potential_libs) {
-    warn "Result:\n\tEXTRALIBS: \n\tLDLOADLIBS: $crtlstr\n" if $verbose;
-    return ('', '', $crtlstr, '', ($give_libs ? [] : ()));
-  }
-
-  my(%found,@fndlibs,$ldlib);
-  my $cwd = cwd();
-  my($so,$lib_ext,$obj_ext) = @Config{'so','lib_ext','obj_ext'};
-  # List of common Unix library names and their VMS equivalents
-  # (VMS equivalent of '' indicates that the library is automatically
-  # searched by the linker, and should be skipped here.)
-  my(@flibs, %libs_seen);
-  my %libmap = ( 'm' => '', 'f77' => '', 'F77' => '', 'V77' => '', 'c' => '',
-                 'malloc' => '', 'crypt' => '', 'resolv' => '', 'c_s' => '',
-                 'socket' => '', 'X11' => 'DECW$XLIBSHR',
-                 'Xt' => 'DECW$XTSHR', 'Xm' => 'DECW$XMLIBSHR',
-                 'Xmu' => 'DECW$XMULIBSHR');
-  if ($Config{'vms_cc_type'} ne 'decc') { $libmap{'curses'} = 'VAXCCURSE'; }
-
-  warn "Potential libraries are '$potential_libs'\n" if $verbose;
-
-  # First, sort out directories and library names in the input
-  my(@dirs, @libs);
-  foreach my $lib (split ' ',$potential_libs) {
-    push(@dirs,$1),   next if $lib =~ /^-L(.*)/;
-    push(@dirs,$lib), next if $lib =~ /[:>\]]$/;
-    push(@dirs,$lib), next if -d $lib;
-    push(@libs,$1),   next if $lib =~ /^-l(.*)/;
-    push(@libs,$lib);
-  }
-  push(@dirs,split(' ',$Config{'libpth'}));
-
-  # Now make sure we've got VMS-syntax absolute directory specs
-  # (We don't, however, check whether someone's hidden a relative
-  # path in a logical name.)
-  foreach my $dir (@dirs) {
-    unless (-d $dir) {
-      warn "Skipping nonexistent Directory $dir\n" if $verbose > 1;
-      $dir = '';
-      next;
-    }
-    warn "Resolving directory $dir\n" if $verbose;
-    if (File::Spec->file_name_is_absolute($dir)) { 
-        $dir = $self->fixpath($dir,1); 
+    # If Config.pm defines a set of default libs, we always
+    # tack them on to the user-supplied list, unless the user
+    # specified :nodefault
+    my $libs = $Config{'perllibs'};
+    $potential_libs = join( ' ', $potential_libs, $libs ) if $libs and $potential_libs !~ /:nodefault/i;
+    _debug( "Potential libraries are '$potential_libs':\n", $verbose );
+
+    $potential_libs =~ s,\\,/,g;    # normalize to forward slashes
+
+    my @list = Text::ParseWords::quotewords( '\s+', 0, $potential_libs );
+
+    return @list;
+}
+
+sub _win32_default_search_paths {
+    my ( $VC ) = @_;
+
+    my $libpth = $Config{'libpth'} || '';
+    $libpth =~ s,\\,/,g;            # normalize to forward slashes
+
+    my @libpath = Text::ParseWords::quotewords( '\s+', 0, $libpth );
+    push @libpath, "$Config{installarchlib}/CORE";    # add "$Config{installarchlib}/CORE" to default search path
+
+    if ( $VC and exists $ENV{LIB} and $ENV{LIB} ) {
+        push @libpath, split /;/, $ENV{LIB};
     }
-    else { 
-        $dir = $self->catdir($cwd,$dir); 
+
+    return @libpath;
+}
+
+sub _win32_search_file {
+    my ( $thislib, $libext, $paths, $verbose, $GC ) = @_;
+
+    my @file_list = _win32_build_file_list( $thislib, $GC, $libext );
+
+    for my $lib_file ( @file_list ) {
+        for my $path ( @{$paths} ) {
+            my $fullname = $lib_file;
+            $fullname = "$path\\$fullname" if $path;
+
+            return ( $fullname, $path ) if -f $fullname;
+
+            _debug( "'$thislib' not found as '$fullname'\n", $verbose );
+        }
     }
-  }
-  @dirs = grep { length($_) } @dirs;
-  unshift(@dirs,''); # Check each $lib without additions first
-
-  LIB: foreach my $lib (@libs) {
-    if (exists $libmap{$lib}) {
-      next unless length $libmap{$lib};
-      $lib = $libmap{$lib};
+
+    return;
+}
+
+sub _win32_build_file_list {
+    my ( $lib, $GC, $extensions ) = @_;
+
+    my @pre_fixed = _win32_build_prefixed_list( $lib, $GC );
+    return map _win32_attach_extensions( $_, $extensions ), @pre_fixed;
+}
+
+sub _win32_build_prefixed_list {
+    my ( $lib, $GC ) = @_;
+
+    return $lib if $lib !~ s/^-l//;
+    return $lib if $lib =~ /^lib/ and !$GC;
+
+    ( my $no_prefix = $lib ) =~ s/^lib//i;
+    $lib = "lib$lib" if $no_prefix eq $lib;
+
+    return ( $lib, $no_prefix ) if $GC;
+    return ( $no_prefix, $lib );
+}
+
+sub _win32_attach_extensions {
+    my ( $lib, $extensions ) = @_;
+    return map _win32_try_attach_extension( $lib, $_ ), @{$extensions};
+}
+
+sub _win32_try_attach_extension {
+    my ( $lib, $extension ) = @_;
+
+    return $lib if $lib =~ /\Q$extension\E$/i;
+    return "$lib$extension";
+}
+
+sub _win32_lib_extensions {
+    my %extensions;
+    $extensions{ $Config{'lib_ext'} } = 1 if $Config{'lib_ext'};
+    $extensions{".lib"} = 1;
+    return [ keys %extensions ];
+}
+
+sub _debug {
+    my ( $message, $verbose ) = @_;
+    return if !$verbose;
+    warn $message;
+    return;
+}
+
+sub _vms_ext {
+    my ( $self, $potential_libs, $verbose, $give_libs ) = @_;
+    $verbose ||= 0;
+
+    my ( @crtls, $crtlstr );
+    @crtls = ( ( $Config{'ldflags'} =~ m-/Debug-i ? $Config{'dbgprefix'} : '' ) . 'PerlShr/Share' );
+    push( @crtls, grep { not /\(/ } split /\s+/, $Config{'perllibs'} );
+    push( @crtls, grep { not /\(/ } split /\s+/, $Config{'libc'} );
+
+    # In general, we pass through the basic libraries from %Config unchanged.
+    # The one exception is that if we're building in the Perl source tree, and
+    # a library spec could be resolved via a logical name, we go to some trouble
+    # to insure that the copy in the local tree is used, rather than one to
+    # which a system-wide logical may point.
+    if ( $self->{PERL_SRC} ) {
+        my ( $locspec, $type );
+        foreach my $lib ( @crtls ) {
+            if ( ( $locspec, $type ) = $lib =~ m{^([\w\$-]+)(/\w+)?} and $locspec =~ /perl/i ) {
+                if    ( lc $type eq '/share' )   { $locspec .= $Config{'exe_ext'}; }
+                elsif ( lc $type eq '/library' ) { $locspec .= $Config{'lib_ext'}; }
+                else                             { $locspec .= $Config{'obj_ext'}; }
+                $locspec = $self->catfile( $self->{PERL_SRC}, $locspec );
+                $lib = "$locspec$type" if -e $locspec;
+            }
+        }
     }
+    $crtlstr = @crtls ? join( ' ', @crtls ) : '';
 
-    my(@variants,$cand);
-    my($ctype) = '';
+    unless ( $potential_libs ) {
+        warn "Result:\n\tEXTRALIBS: \n\tLDLOADLIBS: $crtlstr\n" if $verbose;
+        return ( '', '', $crtlstr, '', ( $give_libs ? [] : () ) );
+    }
 
-    # If we don't have a file type, consider it a possibly abbreviated name and
-    # check for common variants.  We try these first to grab libraries before
-    # a like-named executable image (e.g. -lperl resolves to perlshr.exe
-    # before perl.exe).
-    if ($lib !~ /\.[^:>\]]*$/) {
-      push(@variants,"${lib}shr","${lib}rtl","${lib}lib");
-      push(@variants,"lib$lib") if $lib !~ /[:>\]]/;
+    my ( %found, @fndlibs, $ldlib );
+    my $cwd = cwd();
+    my ( $so, $lib_ext, $obj_ext ) = @Config{ 'so', 'lib_ext', 'obj_ext' };
+
+    # List of common Unix library names and their VMS equivalents
+    # (VMS equivalent of '' indicates that the library is automatically
+    # searched by the linker, and should be skipped here.)
+    my ( @flibs, %libs_seen );
+    my %libmap = (
+        'm'      => '',
+        'f77'    => '',
+        'F77'    => '',
+        'V77'    => '',
+        'c'      => '',
+        'malloc' => '',
+        'crypt'  => '',
+        'resolv' => '',
+        'c_s'    => '',
+        'socket' => '',
+        'X11'    => 'DECW$XLIBSHR',
+        'Xt'     => 'DECW$XTSHR',
+        'Xm'     => 'DECW$XMLIBSHR',
+        'Xmu'    => 'DECW$XMULIBSHR'
+    );
+    if ( $Config{'vms_cc_type'} ne 'decc' ) { $libmap{'curses'} = 'VAXCCURSE'; }
+
+    warn "Potential libraries are '$potential_libs'\n" if $verbose;
+
+    # First, sort out directories and library names in the input
+    my ( @dirs, @libs );
+    foreach my $lib ( split ' ', $potential_libs ) {
+        push( @dirs, $1 ),   next if $lib =~ /^-L(.*)/;
+        push( @dirs, $lib ), next if $lib =~ /[:>\]]$/;
+        push( @dirs, $lib ), next if -d $lib;
+        push( @libs, $1 ),   next if $lib =~ /^-l(.*)/;
+        push( @libs, $lib );
     }
-    push(@variants,$lib);
-    warn "Looking for $lib\n" if $verbose;
-    foreach my $variant (@variants) {
-      my($fullname, $name);
-
-      foreach my $dir (@dirs) {
-        my($type);
-
-        $name = "$dir$variant";
-        warn "\tChecking $name\n" if $verbose > 2;
-        $fullname = VMS::Filespec::rmsexpand($name);
-        if (defined $fullname and -f $fullname) {
-          # It's got its own suffix, so we'll have to figure out the type
-          if    ($fullname =~ /(?:$so|exe)$/i)      { $type = 'SHR'; }
-          elsif ($fullname =~ /(?:$lib_ext|olb)$/i) { $type = 'OLB'; }
-          elsif ($fullname =~ /(?:$obj_ext|obj)$/i) {
-            warn "Note (probably harmless): "
-                ."Plain object file $fullname found in library list\n";
-            $type = 'OBJ';
-          }
-          else {
-            warn "Note (probably harmless): "
-                ."Unknown library type for $fullname; assuming shared\n";
-            $type = 'SHR';
-          }
+    push( @dirs, split( ' ', $Config{'libpth'} ) );
+
+    # Now make sure we've got VMS-syntax absolute directory specs
+    # (We don't, however, check whether someone's hidden a relative
+    # path in a logical name.)
+    foreach my $dir ( @dirs ) {
+        unless ( -d $dir ) {
+            warn "Skipping nonexistent Directory $dir\n" if $verbose > 1;
+            $dir = '';
+            next;
         }
-        elsif (-f ($fullname = VMS::Filespec::rmsexpand($name,$so))      or
-               -f ($fullname = VMS::Filespec::rmsexpand($name,'.exe')))     {
-          $type = 'SHR';
-          $name = $fullname unless $fullname =~ /exe;?\d*$/i;
+        warn "Resolving directory $dir\n" if $verbose;
+        if ( File::Spec->file_name_is_absolute( $dir ) ) {
+            $dir = $self->fixpath( $dir, 1 );
         }
-        elsif (not length($ctype) and  # If we've got a lib already, 
-                                       # don't bother
-               ( -f ($fullname = VMS::Filespec::rmsexpand($name,$lib_ext)) or
-                 -f ($fullname = VMS::Filespec::rmsexpand($name,'.olb'))))  {
-          $type = 'OLB';
-          $name = $fullname unless $fullname =~ /olb;?\d*$/i;
+        else {
+            $dir = $self->catdir( $cwd, $dir );
         }
-        elsif (not length($ctype) and  # If we've got a lib already, 
-                                       # don't bother
-               ( -f ($fullname = VMS::Filespec::rmsexpand($name,$obj_ext)) or
-                 -f ($fullname = VMS::Filespec::rmsexpand($name,'.obj'))))  {
-          warn "Note (probably harmless): "
-                      ."Plain object file $fullname found in library list\n";
-          $type = 'OBJ';
-          $name = $fullname unless $fullname =~ /obj;?\d*$/i;
+    }
+    @dirs = grep { length( $_ ) } @dirs;
+    unshift( @dirs, '' );    # Check each $lib without additions first
+
+  LIB: foreach my $lib ( @libs ) {
+        if ( exists $libmap{$lib} ) {
+            next unless length $libmap{$lib};
+            $lib = $libmap{$lib};
         }
-        if (defined $type) {
-          $ctype = $type; $cand = $name;
-          last if $ctype eq 'SHR';
+
+        my ( @variants, $cand );
+        my ( $ctype ) = '';
+
+        # If we don't have a file type, consider it a possibly abbreviated name and
+        # check for common variants.  We try these first to grab libraries before
+        # a like-named executable image (e.g. -lperl resolves to perlshr.exe
+        # before perl.exe).
+        if ( $lib !~ /\.[^:>\]]*$/ ) {
+            push( @variants, "${lib}shr", "${lib}rtl", "${lib}lib" );
+            push( @variants, "lib$lib" ) if $lib !~ /[:>\]]/;
+        }
+        push( @variants, $lib );
+        warn "Looking for $lib\n" if $verbose;
+        foreach my $variant ( @variants ) {
+            my ( $fullname, $name );
+
+            foreach my $dir ( @dirs ) {
+                my ( $type );
+
+                $name = "$dir$variant";
+                warn "\tChecking $name\n" if $verbose > 2;
+                $fullname = VMS::Filespec::rmsexpand( $name );
+                if ( defined $fullname and -f $fullname ) {
+
+                    # It's got its own suffix, so we'll have to figure out the type
+                    if    ( $fullname =~ /(?:$so|exe)$/i )      { $type = 'SHR'; }
+                    elsif ( $fullname =~ /(?:$lib_ext|olb)$/i ) { $type = 'OLB'; }
+                    elsif ( $fullname =~ /(?:$obj_ext|obj)$/i ) {
+                        warn "Note (probably harmless): " . "Plain object file $fullname found in library list\n";
+                        $type = 'OBJ';
+                    }
+                    else {
+                        warn "Note (probably harmless): " . "Unknown library type for $fullname; assuming shared\n";
+                        $type = 'SHR';
+                    }
+                }
+                elsif (-f ( $fullname = VMS::Filespec::rmsexpand( $name, $so ) )
+                    or -f ( $fullname = VMS::Filespec::rmsexpand( $name, '.exe' ) ) )
+                {
+                    $type = 'SHR';
+                    $name = $fullname unless $fullname =~ /exe;?\d*$/i;
+                }
+                elsif (
+                    not length( $ctype ) and    # If we've got a lib already,
+                                                # don't bother
+                    ( -f ( $fullname = VMS::Filespec::rmsexpand( $name, $lib_ext ) ) or -f ( $fullname = VMS::Filespec::rmsexpand( $name, '.olb' ) ) )
+                  )
+                {
+                    $type = 'OLB';
+                    $name = $fullname unless $fullname =~ /olb;?\d*$/i;
+                }
+                elsif (
+                    not length( $ctype ) and    # If we've got a lib already,
+                                                # don't bother
+                    ( -f ( $fullname = VMS::Filespec::rmsexpand( $name, $obj_ext ) ) or -f ( $fullname = VMS::Filespec::rmsexpand( $name, '.obj' ) ) )
+                  )
+                {
+                    warn "Note (probably harmless): " . "Plain object file $fullname found in library list\n";
+                    $type = 'OBJ';
+                    $name = $fullname unless $fullname =~ /obj;?\d*$/i;
+                }
+                if ( defined $type ) {
+                    $ctype = $type;
+                    $cand  = $name;
+                    last if $ctype eq 'SHR';
+                }
+            }
+            if ( $ctype ) {
+
+                # This has to precede any other CRTLs, so just make it first
+                if ( $cand eq 'VAXCCURSE' ) { unshift @{ $found{$ctype} }, $cand; }
+                else                        { push @{ $found{$ctype} }, $cand; }
+                warn "\tFound as $cand (really $fullname), type $ctype\n"
+                  if $verbose > 1;
+                push @flibs, $name unless $libs_seen{$fullname}++;
+                next LIB;
+            }
         }
-      }
-      if ($ctype) { 
-        # This has to precede any other CRTLs, so just make it first
-        if ($cand eq 'VAXCCURSE') { unshift @{$found{$ctype}}, $cand; }  
-        else                      { push    @{$found{$ctype}}, $cand; }
-        warn "\tFound as $cand (really $fullname), type $ctype\n" 
-          if $verbose > 1;
-       push @flibs, $name unless $libs_seen{$fullname}++;
-        next LIB;
-      }
+        warn "Note (probably harmless): " . "No library found for $lib\n";
     }
-    warn "Note (probably harmless): "
-                ."No library found for $lib\n";
-  }
-
-  push @fndlibs, @{$found{OBJ}}                      if exists $found{OBJ};
-  push @fndlibs, map { "$_/Library" } @{$found{OLB}} if exists $found{OLB};
-  push @fndlibs, map { "$_/Share"   } @{$found{SHR}} if exists $found{SHR};
-  my $lib = join(' ',@fndlibs);
-
-  $ldlib = $crtlstr ? "$lib $crtlstr" : $lib;
-  warn "Result:\n\tEXTRALIBS: $lib\n\tLDLOADLIBS: $ldlib\n" if $verbose;
-  wantarray ? ($lib, '', $ldlib, '', ($give_libs ? \@flibs : ())) : $lib;
+
+    push @fndlibs, @{ $found{OBJ} } if exists $found{OBJ};
+    push @fndlibs, map { "$_/Library" } @{ $found{OLB} } if exists $found{OLB};
+    push @fndlibs, map { "$_/Share" } @{ $found{SHR} }   if exists $found{SHR};
+    my $lib = join( ' ', @fndlibs );
+
+    $ldlib = $crtlstr ? "$lib $crtlstr" : $lib;
+    warn "Result:\n\tEXTRALIBS: $lib\n\tLDLOADLIBS: $ldlib\n" if $verbose;
+    wantarray ? ( $lib, '', $ldlib, '', ( $give_libs ? \@flibs : () ) ) : $lib;
 }
 
 1;
index 945f245..ce3e073 100644 (file)
@@ -3,7 +3,7 @@ package ExtUtils::MM;
 use strict;
 use ExtUtils::MakeMaker::Config;
 
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 require ExtUtils::Liblist;
 require ExtUtils::MakeMaker;
index 0212385..3d33e7f 100644 (file)
@@ -1,7 +1,7 @@
 package ExtUtils::MM_AIX;
 
 use strict;
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 require ExtUtils::MM_Unix;
 our @ISA = qw(ExtUtils::MM_Unix);
index a38f274..6a50c01 100644 (file)
@@ -1,7 +1,7 @@
 package ExtUtils::MM_Any;
 
 use strict;
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 use Carp;
 use File::Spec;
@@ -486,8 +486,8 @@ clean :: clean_subdirs
                         split /\s+/, $attribs{FILES}   ;
     }
 
-    push(@files, qw[$(MAKE_APERL_FILE)
-                    MYMETA.yml perlmain.c tmon.out mon.out so_locations
+    push(@files, qw[$(MAKE_APERL_FILE) 
+                    MYMETA.json MYMETA.yml perlmain.c tmon.out mon.out so_locations
                     blibdirs.ts pm_to_blib pm_to_blib.ts
                     *$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT)
                     $(BOOTSTRAP) $(BASEEXT).bso
@@ -728,6 +728,13 @@ CMD
     return $manify;
 }
 
+sub _has_cpan_meta {
+    return eval {
+      $INC{'CPAN/Meta.pm'} or require CPAN::Meta;
+      CPAN::Meta->VERSION(2.110350);
+      1;
+    };
+}
 
 =head3 metafile_target
 
@@ -743,28 +750,106 @@ possible.
 
 sub metafile_target {
     my $self = shift;
-
-    return <<'MAKE_FRAG' if $self->{NO_META};
+    return <<'MAKE_FRAG' if $self->{NO_META} or ! _has_cpan_meta();
 metafile :
        $(NOECHO) $(NOOP)
 MAKE_FRAG
 
-    my @metadata   = $self->metafile_data(
+    my %metadata   = $self->metafile_data(
         $self->{META_ADD}   || {},
         $self->{META_MERGE} || {},
     );
-    my $meta       = $self->metafile_file(@metadata);
-    my @write_meta = $self->echo($meta, 'META_new.yml');
+    
+    _fix_metadata_before_conversion( \%metadata );
+
+    # paper over validation issues, but still complain, necessary because
+    # there's no guarantee that the above will fix ALL errors
+    my $meta = eval { CPAN::Meta->create( \%metadata, { lazy_validation => 1 } ) };
+    warn $@ if $@ and 
+               $@ !~ /encountered CODE.*, but JSON can only represent references to arrays or hashes/;
+
+    # use the original metadata straight if the conversion failed
+    # or if it can't be stringified.
+    if( !$meta                                                  ||
+        !eval { $meta->as_string( { version => "1.4" } ) }      ||
+        !eval { $meta->as_string }
+    )
+    {
+        $meta = bless \%metadata, 'CPAN::Meta';
+    }
 
-    return sprintf <<'MAKE_FRAG', join("\n\t", @write_meta);
+    my @write_metayml = $self->echo(
+      $meta->as_string({version => "1.4"}), 'META_new.yml'
+    );
+    my @write_metajson = $self->echo(
+      $meta->as_string(), 'META_new.json'
+    );
+
+    my $metayml = join("\n\t", @write_metayml);
+    my $metajson = join("\n\t", @write_metajson);
+    return sprintf <<'MAKE_FRAG', $metayml, $metajson;
 metafile : create_distdir
        $(NOECHO) $(ECHO) Generating META.yml
        %s
        -$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml
+       $(NOECHO) $(ECHO) Generating META.json
+       %s
+       -$(NOECHO) $(MV) META_new.json $(DISTVNAME)/META.json
 MAKE_FRAG
 
 }
 
+=begin private
+
+=head3 _fix_metadata_before_conversion
+
+    _fix_metadata_before_conversion( \%metadata );
+
+Fixes errors in the metadata before it's handed off to CPAN::Meta for
+conversion. This hopefully results in something that can be used further
+on, no guarantee is made though.
+
+=end private
+
+=cut
+
+sub _fix_metadata_before_conversion {
+    my ( $metadata ) = @_;
+
+    my $bad_version = $metadata->{version} &&
+                      !CPAN::Meta::Validator->new->version( 'version', $metadata->{version} );
+
+    # just delete all invalid versions
+    if( $bad_version ) {
+        warn "Can't parse version '$metadata->{version}'\n";
+        $metadata->{version} = '';
+    }
+
+    my $validator = CPAN::Meta::Validator->new( $metadata );
+    return if $validator->is_valid;
+
+    # fix non-camelcase custom resource keys (only other trick we know)
+    for my $error ( $validator->errors ) {
+        my ( $key ) = ( $error =~ /Custom resource '(.*)' must be in CamelCase./ );
+        next if !$key;
+
+        # first try to remove all non-alphabetic chars
+        ( my $new_key = $key ) =~ s/[^_a-zA-Z]//g;
+
+        # if that doesn't work, uppercase first one
+        $new_key = ucfirst $new_key if !$validator->custom_1( $new_key );
+
+        # copy to new key if that worked
+        $metadata->{resources}{$new_key} = $metadata->{resources}{$key}
+          if $validator->custom_1( $new_key );
+
+        # and delete old one in any case
+        delete $metadata->{resources}{$key};
+    }
+
+    return;
+}
+
 
 =begin private
 
@@ -816,57 +901,16 @@ sub metafile_data {
     my $self = shift;
     my($meta_add, $meta_merge) = @_;
 
-    # The order in which standard meta keys should be written.
-    my @meta_order = qw(
-        name
-        version
-        abstract
-        author
-        license
-        distribution_type
-
-        configure_requires
-        build_requires
-        requires
-
-        resources
-
-        provides
-        no_index
-
-        generated_by
-        meta-spec
-    );
-
-    # Check the original args so we can tell between the user setting it
-    # to an empty hash and it just being initialized.
-    my $configure_requires;
-    if( $self->{ARGS}{CONFIGURE_REQUIRES} ) {
-        $configure_requires = $self->{CONFIGURE_REQUIRES};
-    } else {
-        $configure_requires = {
-            'ExtUtils::MakeMaker'       => 0,
-        };
-    }
-    my $build_requires;
-    if( $self->{ARGS}{BUILD_REQUIRES} ) {
-        $build_requires = $self->{BUILD_REQUIRES};
-    } else {
-        $build_requires = {
-            'ExtUtils::MakeMaker'       => 0,
-        };
-    }
-
     my %meta = (
+        # required
         name         => $self->{DISTNAME},
-        version      => $self->{VERSION},
-        abstract     => $self->{ABSTRACT},
+        version      => _normalize_version($self->{VERSION}),
+        abstract     => $self->{ABSTRACT} || 'unknown',
         license      => $self->{LICENSE} || 'unknown',
-        distribution_type => $self->{PM} ? 'module' : 'script',
+        dynamic_config => 1,
 
-        configure_requires => $configure_requires,
-
-        build_requires => $build_requires,
+        # optional
+        distribution_type => $self->{PM} ? 'module' : 'script',
 
         no_index     => {
             directory   => [qw(t inc)]
@@ -882,8 +926,18 @@ sub metafile_data {
     # The author key is required and it takes a list.
     $meta{author}   = defined $self->{AUTHOR}    ? $self->{AUTHOR} : [];
 
-    $meta{requires} = $self->{PREREQ_PM} if defined $self->{PREREQ_PM};
-    $meta{requires}{perl} = $self->{MIN_PERL_VERSION} if $self->{MIN_PERL_VERSION};
+    # Check the original args so we can tell between the user setting it
+    # to an empty hash and it just being initialized.
+    if( $self->{ARGS}{CONFIGURE_REQUIRES} ) {
+        $meta{configure_requires}
+            = _normalize_prereqs($self->{CONFIGURE_REQUIRES});
+    } else {
+        $meta{configure_requires} = {
+            'ExtUtils::MakeMaker'       => 0,
+        };
+    }
+
+    %meta = $self->_add_requirements_to_meta( %meta );
 
     while( my($key, $val) = each %$meta_add ) {
         $meta{$key} = $val;
@@ -893,24 +947,62 @@ sub metafile_data {
         $self->_hash_merge(\%meta, $key, $val);
     }
 
-    my @meta_pairs;
+    return %meta;
+}
+
 
-    # Put the standard keys first in the proper order.
-    for my $key (@meta_order) {
-        next unless exists $meta{$key};
+=begin private
 
-        push @meta_pairs, $key, delete $meta{$key};
-    }
+=cut
 
-    # Then tack everything else onto the end, alpha sorted.
-    for my $key (sort {lc $a cmp lc $b} keys %meta) {
-        push @meta_pairs, $key, $meta{$key};
+sub _add_requirements_to_meta {
+    my ( $self, %meta ) = @_;
+
+    # Check the original args so we can tell between the user setting it
+    # to an empty hash and it just being initialized.
+
+    if( $self->{ARGS}{BUILD_REQUIRES} ) {
+        $meta{build_requires} = _normalize_prereqs($self->{BUILD_REQUIRES});
+    } else {
+        $meta{build_requires} = {
+            'ExtUtils::MakeMaker'       => 0,
+        };
     }
 
-    return @meta_pairs
+    $meta{requires} = _normalize_prereqs($self->{PREREQ_PM})
+        if defined $self->{PREREQ_PM};
+    $meta{requires}{perl} = _normalize_version($self->{MIN_PERL_VERSION})
+        if $self->{MIN_PERL_VERSION};
+
+    return %meta;
 }
 
-=begin private
+sub _normalize_prereqs {
+  my ($hash) = @_;
+  my %prereqs;
+  while ( my ($k,$v) = each %$hash ) {
+    $prereqs{$k} = _normalize_version($v);
+  }
+  return \%prereqs;
+}
+
+# Adapted from Module::Build::Base
+sub _normalize_version {
+  my ($version) = @_;
+  $version = 0 unless defined $version;
+
+  if ( ref $version eq 'version' ) { # version objects
+    $version = $version->is_qv ? $version->normal : $version->stringify;
+  }
+  elsif ( $version =~ /^[^v][^.]*\.[^.]+\./ ) { # no leading v, multiple dots
+    # normalize string tuples without "v": "1.2.3" -> "v1.2.3"
+    $version = "v$version";
+  }
+  else {
+    # leave alone
+  }
+  return $version;
+}
 
 =head3 _dump_hash
 
@@ -1069,16 +1161,25 @@ distdir.
 sub distmeta_target {
     my $self = shift;
 
-    my $add_meta = $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']);
-eval { maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}}) } 
+    my @add_meta = (
+      $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']),
+exit unless -e q{META.yml};
+eval { maniadd({q{META.yml} => q{Module YAML meta-data (added by MakeMaker)}}) }
     or print "Could not add META.yml to MANIFEST: $${'@'}\n"
 CODE
+      $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd'])
+exit unless -f q{META.json};
+eval { maniadd({q{META.json} => q{Module JSON meta-data (added by MakeMaker)}}) }
+    or print "Could not add META.json to MANIFEST: $${'@'}\n"
+CODE
+    );
 
-    my $add_meta_to_distdir = $self->cd('$(DISTVNAME)', $add_meta);
+    my @add_meta_to_distdir = map { $self->cd('$(DISTVNAME)', $_) } @add_meta;
 
-    return sprintf <<'MAKE', $add_meta_to_distdir;
+    return sprintf <<'MAKE', @add_meta_to_distdir;
 distmeta : create_distdir metafile
        $(NOECHO) %s
+       $(NOECHO) %s
 
 MAKE
 
@@ -1096,12 +1197,9 @@ or from internal data.
 
 sub mymeta {
     my $self = shift;
+    my $file = shift || ''; # for testing
 
-    my $mymeta;
-
-    if ( -e 'META.yml' ) {
-        $mymeta = $self->_mymeta_from_meta();
-    }
+    my $mymeta = $self->_mymeta_from_meta($file);
 
     unless ( $mymeta ) {
         my @metadata = $self->metafile_data(
@@ -1111,6 +1209,10 @@ sub mymeta {
         $mymeta = {@metadata};
     }
 
+    # Overwrite the non-configure dependency hashes
+
+    $mymeta = { $self->_add_requirements_to_meta( %$mymeta ) };
+
     $mymeta->{dynamic_config} = 0;
 
     return $mymeta;
@@ -1119,14 +1221,20 @@ sub mymeta {
 
 sub _mymeta_from_meta {
     my $self = shift;
+    my $metafile = shift || ''; # for testing
+
+    return unless _has_cpan_meta();
 
     my $meta;
-    eval {
-        my @yaml = ExtUtils::MakeMaker::YAML::LoadFile('META.yml');
-        $meta = $yaml[0];
-    };
+    for my $file ( $metafile, "META.json", "META.yml" ) {
+      next unless -e $file;
+      eval {
+          $meta = CPAN::Meta->load_file($file)->as_struct( {version => "1.4"} );
+      };
+      last if $meta;
+    }
     return undef unless $meta;
-
+    
     # META.yml before 6.25_01 cannot be trusted.  META.yml lived in the source directory.
     # There was a good chance the author accidentally uploaded a stale META.yml if they
     # rolled their own tarball rather than using "make dist".
@@ -1138,20 +1246,9 @@ sub _mymeta_from_meta {
         }
     }
 
-    # Overwrite the non-configure dependency hashs
-    delete $meta->{requires};
-    delete $meta->{build_requires};
-    delete $meta->{recommends};
-    if ( exists $self->{PREREQ_PM} ) {
-        $meta->{requires} = $self->{PREREQ_PM} || {};
-    }
-    if ( exists $self->{BUILD_REQUIRES} ) {
-        $meta->{build_requires} = $self->{BUILD_REQUIRES} || {};
-    }
     return $meta;
 }
 
-
 =head3 write_mymeta
 
     $self->write_mymeta( $mymeta );
@@ -1166,18 +1263,19 @@ sub write_mymeta {
     my $self = shift;
     my $mymeta = shift;
 
-    require ExtUtils::MakeMaker::YAML;
-    my $mymeta_content = ExtUtils::MakeMaker::YAML::Dump($mymeta);
+    return unless _has_cpan_meta();
 
-    open(my $myfh, ">", "MYMETA.yml")
-      or die "Unable to open MYMETA.yml: $!";
-    print $myfh $mymeta_content;
-    close $myfh;
-
-    return;
+    _fix_metadata_before_conversion( $mymeta );
+    
+    # this can still blow up
+    # not sure if i should just eval this and skip file creation if it
+    # blows up
+    my $meta_obj = CPAN::Meta->new( $mymeta, { lazy_validation => 1 } );
+    $meta_obj->save( 'MYMETA.json' );
+    $meta_obj->save( 'MYMETA.yml', { version => "1.4" } );
+    return 1;
 }
 
-
 =head3 realclean (o)
 
 Defines the realclean target.
@@ -1398,7 +1496,7 @@ sub init_INST {
     # perl has been built and installed. Setting INST_LIB allows
     # you to build directly into, say $Config{privlibexp}.
     unless ($self->{INST_LIB}){
-       if ($self->{PERL_CORE}) {
+        if ($self->{PERL_CORE}) {
             if (defined $Cross::platform) {
                 $self->{INST_LIB} = $self->{INST_ARCHLIB} = 
                   $self->catdir($self->{PERL_LIB},"..","xlib",
@@ -1407,9 +1505,9 @@ sub init_INST {
             else {
                 $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB};
             }
-       } else {
-           $self->{INST_LIB} = $self->catdir($Curdir,"blib","lib");
-       }
+        } else {
+            $self->{INST_LIB} = $self->catdir($Curdir,"blib","lib");
+        }
     }
 
     my @parentdir = split(/::/, $self->{PARENT_NAME});
index 0eeb795..15918c9 100644 (file)
@@ -26,7 +26,7 @@ require ExtUtils::MM_Any;
 require ExtUtils::MM_Unix;
 
 our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 
 =item os_flavor
index d6ce3a7..7417b43 100644 (file)
@@ -9,7 +9,7 @@ require ExtUtils::MM_Unix;
 require ExtUtils::MM_Win32;
 our @ISA = qw( ExtUtils::MM_Unix );
 
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 
 =head1 NAME
index 68612a8..915fc33 100644 (file)
@@ -2,7 +2,7 @@ package ExtUtils::MM_DOS;
 
 use strict;
 
-our $VERSION = 6.57_05;
+our $VERSION = '6.58';
 
 require ExtUtils::MM_Any;
 require ExtUtils::MM_Unix;
index 20aeb79..ca120a3 100644 (file)
@@ -7,7 +7,7 @@ BEGIN {
     our @ISA = qw( ExtUtils::MM_Unix );
 }
 
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 
 =head1 NAME
index 4dcb6e5..33e5036 100644 (file)
@@ -2,7 +2,7 @@ package ExtUtils::MM_MacOS;
 
 use strict;
 
-our $VERSION = 6.57_05;
+our $VERSION = '6.58';
 
 sub new {
     die <<'UNSUPPORTED';
index 2089e8f..3e4ca58 100644 (file)
@@ -22,7 +22,7 @@ use strict;
 use ExtUtils::MakeMaker::Config;
 use File::Basename;
 
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 require ExtUtils::MM_Win32;
 our @ISA = qw(ExtUtils::MM_Win32);
index 46d57be..4d10020 100644 (file)
@@ -5,7 +5,7 @@ use strict;
 use ExtUtils::MakeMaker qw(neatvalue);
 use File::Spec;
 
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 require ExtUtils::MM_Any;
 require ExtUtils::MM_Unix;
index 5efd377..f81c1c3 100644 (file)
@@ -1,7 +1,7 @@
 package ExtUtils::MM_QNX;
 
 use strict;
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 require ExtUtils::MM_Unix;
 our @ISA = qw(ExtUtils::MM_Unix);
index 032bf35..6b9b6a6 100644 (file)
@@ -1,7 +1,7 @@
 package ExtUtils::MM_UWIN;
 
 use strict;
-our $VERSION = 6.57_05;
+our $VERSION = '6.58';
 
 require ExtUtils::MM_Unix;
 our @ISA = qw(ExtUtils::MM_Unix);
index 6964eea..b854887 100644 (file)
@@ -15,7 +15,8 @@ use ExtUtils::MakeMaker qw($Verbose neatvalue);
 
 # If we make $VERSION an our variable parse_version() breaks
 use vars qw($VERSION);
-$VERSION = '6.57_05';
+$VERSION = '6.58';
+$VERSION = eval $VERSION;
 
 require ExtUtils::MM_Any;
 our @ISA = qw(ExtUtils::MM_Any);
index d6b63eb..3d52b87 100644 (file)
@@ -15,7 +15,7 @@ BEGIN {
 
 use File::Basename;
 
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 require ExtUtils::MM_Any;
 require ExtUtils::MM_Unix;
index e5b60d7..9a427c6 100644 (file)
@@ -1,7 +1,7 @@
 package ExtUtils::MM_VOS;
 
 use strict;
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 require ExtUtils::MM_Unix;
 our @ISA = qw(ExtUtils::MM_Unix);
index faaf219..5a1fd32 100644 (file)
@@ -27,13 +27,21 @@ use ExtUtils::MakeMaker qw( neatvalue );
 require ExtUtils::MM_Any;
 require ExtUtils::MM_Unix;
 our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 $ENV{EMXSHELL} = 'sh'; # to run `commands`
 
-my $BORLAND = $Config{'cc'} =~ /^bcc/i ? 1 : 0;
-my $GCC     = $Config{'cc'} =~ /\bgcc$/i ? 1 : 0;
-my $DLLTOOL = $Config{'dlltool'} || 'dlltool';
+my ( $BORLAND, $GCC, $DLLTOOL ) = _identify_compiler_environment( \%Config );
+
+sub _identify_compiler_environment {
+       my ( $config ) = @_;
+
+       my $BORLAND = $config->{cc} =~ /^bcc/i ? 1 : 0;
+       my $GCC     = $config->{cc} =~ /\bgcc\b/i ? 1 : 0;
+       my $DLLTOOL = $config->{dlltool} || 'dlltool';
+
+       return ( $BORLAND, $GCC, $DLLTOOL );
+}
 
 
 =head2 Overridden methods
@@ -195,6 +203,8 @@ sub init_platform {
     my($self) = shift;
 
     $self->{MM_Win32_VERSION} = $VERSION;
+
+    return;
 }
 
 sub platform_constants {
@@ -211,6 +221,36 @@ sub platform_constants {
 }
 
 
+=item constants
+
+Add MAXLINELENGTH for dmake before all the constants are output.
+
+=cut
+
+sub constants {
+    my $self = shift;
+
+    my $make_text = $self->SUPER::constants;
+    return $make_text unless $self->is_make_type('dmake');
+
+    # dmake won't read any single "line" (even those with escaped newlines)
+    # larger than a certain size which can be as small as 8k.  PM_TO_BLIB
+    # on large modules like DateTime::TimeZone can create lines over 32k.
+    # So we'll crank it up to a <ironic>WHOPPING</ironic> 64k.
+    #
+    # This has to come here before all the constants and not in
+    # platform_constants which is after constants.
+    my $size = $self->{MAXLINELENGTH} || 64 * 1024;
+    my $prefix = qq{
+# Get dmake to read long commands like PM_TO_BLIB
+MAXLINELENGTH = $size
+
+};
+
+    return $prefix . $make_text;
+}
+
+
 =item special_targets
 
 Add .USESHELL target for dmake.
@@ -447,9 +487,31 @@ sub oneliner {
 sub quote_literal {
     my($self, $text) = @_;
 
-    # I don't know if this is correct, but it seems to work on
-    # Win98's command.com
-    $text =~ s{"}{\\"}g;
+    # DOS batch processing is hilarious:
+    # Quotes need to be converted into triple quotes.
+    # Certain special characters need to be escaped with a caret if an odd
+    # number of quotes came before them.
+    my @text        = split '', $text;
+    my $quote_count = 0;
+    my %caret_chars = map { $_ => 1 } qw( < > | );
+    for my $char ( @text ) {
+        if ( $char eq '"' ) {
+            $quote_count++;
+            $char = '"""';
+        }
+        elsif ( $caret_chars{$char} and $quote_count % 2 ) {
+            $char = "^$char";
+        }
+        elsif ( $char eq "\\" ) {
+            $char = "\\\\";
+        }
+    }
+    $text = join '', @text;
+    
+    # There is a terribly confusing edge case here, where this will do entirely the wrong thing:
+    # perl -e "use Data::Dumper; @ARGV = '%PATH%'; print Dumper( \@ARGV );print qq{@ARGV};" --
+    # I have no idea how to fix this manually, much less programmatically.
+    # However as it is such a rare edge case i'll just leave this documentation here and hope it never happens.
 
     # dmake eats '{' inside double quotes and leaves alone { outside double
     # quotes; however it transforms {{ into { either inside and outside double
index 19f5c7d..71115a8 100644 (file)
@@ -2,7 +2,7 @@ package ExtUtils::MM_Win95;
 
 use strict;
 
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 require ExtUtils::MM_Win32;
 our @ISA = qw(ExtUtils::MM_Win32);
index 464f814..5591d47 100644 (file)
@@ -3,7 +3,7 @@ package ExtUtils::MY;
 use strict;
 require ExtUtils::MM;
 
-our $VERSION = 6.57_05;
+our $VERSION = '6.58';
 our @ISA = qw(ExtUtils::MM);
 
 {
index be9624e..6173b6b 100644 (file)
@@ -7,7 +7,7 @@ BEGIN {require 5.006;}
 
 require Exporter;
 use ExtUtils::MakeMaker::Config;
-use Carp ();
+use Carp;
 use File::Path;
 
 our $Verbose = 0;       # exported
@@ -18,7 +18,8 @@ our @Overridable;
 my @Prepend_parent;
 my %Recognized_Att_Keys;
 
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
+$VERSION = eval $VERSION;
 
 # Emulate something resembling CVS $Revision$
 (our $Revision = $VERSION) =~ s{_}{};
@@ -47,13 +48,13 @@ require ExtUtils::MY;  # XXX pre-5.8 versions of ExtUtils::Embed expect
 
 
 sub WriteMakefile {
-    Carp::croak "WriteMakefile: Need even number of args" if @_ % 2;
+    croak "WriteMakefile: Need even number of args" if @_ % 2;
 
     require ExtUtils::MY;
     my %att = @_;
 
     _convert_compat_attrs(\%att);
-
+    
     _verify_att(\%att);
 
     my $mm = MM->new(\%att);
@@ -114,7 +115,7 @@ my %Special_Sigs = (
 @Att_Sigs{keys %Recognized_Att_Keys} = ('') x keys %Recognized_Att_Keys;
 @Att_Sigs{keys %Special_Sigs} = values %Special_Sigs;
 
-sub _convert_compat_attrs {
+sub _convert_compat_attrs { #result of running several times should be same
     my($att) = @_;
     if (exists $att->{AUTHOR}) {
         if ($att->{AUTHOR}) {
@@ -176,7 +177,7 @@ sub _format_att {
 
 sub prompt ($;$) {  ## no critic
     my($mess, $def) = @_;
-    Carp::confess("prompt function called without an argument") 
+    confess("prompt function called without an argument") 
         unless defined $mess;
 
     my $isa_tty = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ;
@@ -224,7 +225,7 @@ sub eval_in_subdirs {
 
 sub eval_in_x {
     my($self,$dir) = @_;
-    chdir $dir or Carp::carp("Couldn't change to directory $dir: $!");
+    chdir $dir or carp("Couldn't change to directory $dir: $!");
 
     {
         package main;
@@ -401,6 +402,8 @@ sub new {
     my($class,$self) = @_;
     my($key);
 
+    _convert_compat_attrs($self) if defined $self && $self;
+
     # Store the original args passed to WriteMakefile()
     foreach my $k (keys %$self) {
         $self->{ARGS}{$k} = $self->{$k};
@@ -408,13 +411,17 @@ sub new {
 
     $self = {} unless defined $self;
 
-    $self->{PREREQ_PM}      ||= {};
-    $self->{BUILD_REQUIRES} ||= {};
-
     # Temporarily bless it into MM so it can be used as an
     # object.  It will be blessed into a temp package later.
     bless $self, "MM";
 
+    # Cleanup all the module requirement bits
+    for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES)) {
+        $self->{$key}      ||= {};
+        $self->clean_versions( $key );
+    }
+
+
     if ("@ARGV" =~ /\bPREREQ_PRINT\b/) {
         $self->_PREREQ_PRINT;
     }
@@ -446,7 +453,7 @@ sub new {
     };
     if (!$perl_version_ok) {
         if (!defined $perl_version_ok) {
-            warn <<'END';
+            die <<'END';
 Warning: MIN_PERL_VERSION is not in a recognized format.
 Recommended is a quoted numerical value like '5.005' or '5.008001'.
 END
@@ -515,13 +522,13 @@ END
             _convert_compat_attrs(\%configure_att);
             $self = { %$self, %configure_att };
         } else {
-            Carp::croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n";
+            croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n";
         }
     }
 
     # This is for old Makefiles written pre 5.00, will go away
     if ( Carp::longmess("") =~ /runsubdirpl/s ){
-        Carp::carp("WARNING: Please rerun 'perl Makefile.PL' to regenerate your Makefiles\n");
+        carp("WARNING: Please rerun 'perl Makefile.PL' to regenerate your Makefiles\n");
     }
 
     my $newclass = ++$PACKNAME;
@@ -692,11 +699,11 @@ END
 }
 
 sub WriteEmptyMakefile {
-    Carp::croak "WriteEmptyMakefile: Need an even number of args" if @_ % 2;
+    croak "WriteEmptyMakefile: Need an even number of args" if @_ % 2;
 
     my %att = @_;
     my $self = MM->new(\%att);
-    
+
     my $new = $self->{MAKEFILE};
     my $old = $self->{MAKEFILE_OLD};
     if (-f $old) {
@@ -1029,9 +1036,10 @@ sub flush {
 
     unless ($self->{NO_MYMETA}) {
         # Write MYMETA.yml to communicate metadata up to the CPAN clients
-        print STDOUT "Writing MYMETA.yml\n";
+        if ( $self->write_mymeta( $self->mymeta ) ) {;
+            print STDOUT "Writing MYMETA.yml and MYMETA.json\n";
+        }
 
-        $self->write_mymeta( $self->mymeta );
     }
     my %keep = map { ($_ => 1) } qw(NEEDS_LINKING HAS_LINK_CODE);
     if ($self->{PARENT} && !$self->{_KEEP_AFTER_FLUSH}) {
@@ -1103,6 +1111,22 @@ sub neatvalue {
     return "{ ".join(', ',@m)." }";
 }
 
+# Look for weird version numbers, warn about them and set them to 0
+# before CPAN::Meta chokes.
+sub clean_versions {
+    my($self, $key) = @_;
+
+    my $reqs = $self->{$key};
+    for my $module (keys %$reqs) {
+        my $version = $reqs->{$module};
+
+        if( !defined $version or $version !~ /^[\d_\.]+$/ ) {
+            carp "Unparsable version '$version' for prerequisite $module";
+            $reqs->{$module} = 0;
+        }
+    }
+}
+
 sub selfdocument {
     my($self) = @_;
     my(@m);
@@ -1491,8 +1515,8 @@ the first line in the "=head1 NAME" section. $2 becomes the abstract.
 =item AUTHOR
 
 Array of strings containing name (and email address) of package author(s).
-Is used in META.yml and PPD (Perl Package Description) files for PPM (Perl
-Package Manager).
+Is used in CPAN Meta files (META.yml or META.json) and PPD
+(Perl Package Description) files for PPM (Perl Package Manager).
 
 =item BINARY_LOCATION
 
@@ -1509,7 +1533,8 @@ located in the C<x86> directory relative to the PPD itself.
 
 A hash of modules that are needed to build your module but not run it.
 
-This will go into the C<build_requires> field of your F<META.yml>.
+This will go into the C<build_requires> field of your CPAN Meta file.
+(F<META.yml> or F<META.json>).
 
 The format is the same as PREREQ_PM.
 
@@ -1556,7 +1581,8 @@ be determined by some evaluation method.
 A hash of modules that are required to run Makefile.PL itself, but not
 to run your distribution.
 
-This will go into the C<configure_requires> field of your F<META.yml>.
+This will go into the C<configure_requires> field of your CPAN Meta file
+(F<META.yml> or F<META.json>)
 
 Defaults to C<<< { "ExtUtils::MakeMaker" => 0 } >>>
 
@@ -1963,7 +1989,8 @@ may hold a name for that binary. Defaults to perl
 
 =item META_MERGE
 
-A hashrefs of items to add to the F<META.yml>.
+A hashrefs of items to add to the CPAN Meta file (F<META.yml> or
+F<META.json>).
 
 They differ in how they behave if they have the same key as the
 default metadata.  META_ADD will override the default value with its
@@ -2012,14 +2039,14 @@ Boolean.  Attribute to inhibit descending into subdirectories.
 =item NO_META
 
 When true, suppresses the generation and addition to the MANIFEST of
-the META.yml module meta-data file during 'make distdir'.
+the META.yml and META.json module meta-data files during 'make distdir'.
 
 Defaults to false.
 
 =item NO_MYMETA
 
-When true, suppresses the generation of MYMETA.yml module meta-data file
-during 'perl Makefile.PL'.
+When true, suppresses the generation of MYMETA.yml and MYMETA.json module
+meta-data files during 'perl Makefile.PL'.
 
 Defaults to false.
 
@@ -2276,7 +2303,8 @@ A hash of modules that are needed to run your module.  The keys are
 the module names ie. Test::More, and the minimum version is the
 value. If the required version number is 0 any version will do.
 
-This will go into the C<requires> field of your F<META.yml>.
+This will go into the C<requires> field of your CPAN Meta file
+(F<META.yml> or F<META.json>).
 
     PREREQ_PM => {
         # Require Test::More at least 0.47
@@ -2641,8 +2669,8 @@ Copies all the files that are in the MANIFEST file to a newly created
 directory with the name C<$(DISTNAME)-$(VERSION)>. If that directory
 exists, it will be removed first.
 
-Additionally, it will create a META.yml module meta-data file in the
-distdir and add this to the distdir's MANIFEST.  You can shut this
+Additionally, it will create META.yml and META.json module meta-data file
+in the distdir and add this to the distdir's MANIFEST.  You can shut this
 behavior off with the NO_META flag.
 
 =item   make disttest
@@ -2716,26 +2744,37 @@ An example:
     );
 
 
-=head2 Module Meta-Data
+=head2 Module Meta-Data (META and MYMETA)
 
 Long plaguing users of MakeMaker based modules has been the problem of
 getting basic information about the module out of the sources
 I<without> running the F<Makefile.PL> and doing a bunch of messy
-heuristics on the resulting F<Makefile>.  To this end a simple module
-meta-data file has been introduced, F<META.yml>.
-
-F<META.yml> is a YAML document (see http://www.yaml.org) containing
-basic information about the module (name, version, prerequisites...)
-in an easy to read format.  The format is developed and defined by the
-Module::Build developers (see 
-http://module-build.sourceforge.net/META-spec.html)
-
-MakeMaker will automatically generate a F<META.yml> file for you and
-add it to your F<MANIFEST> as part of the 'distdir' target (and thus
-the 'dist' target).  This is intended to seamlessly and rapidly
-populate CPAN with module meta-data.  If you wish to shut this feature
-off, set the C<NO_META> C<WriteMakefile()> flag to true.
-
+heuristics on the resulting F<Makefile>.  Over the years, it has become
+standard to keep this information in one or more CPAN Meta files
+distributed with each distribution.
+
+The original format of CPAN Meta files was L<YAML> and the corresponding
+file was called F<META.yml>.  In 2010, version 2 of the L<CPAN::Meta::Spec>
+was released, which mandates JSON format for the metadata in order to
+overcome certain compatibility issues between YAML serializers and to
+avoid breaking older clients unable to handle a new version of the spec.
+The L<CPAN::Meta> library is now standard for accessing old and new-style
+Meta files.
+
+If L<CPAN::Meta> is installed, MakeMaker will automatically generate
+F<META.json> and F<META.yml> files for you and add them to your F<MANIFEST> as
+part of the 'distdir' target (and thus the 'dist' target).  This is intended to
+seamlessly and rapidly populate CPAN with module meta-data.  If you wish to
+shut this feature off, set the C<NO_META> C<WriteMakefile()> flag to true.
+
+At the 2008 QA Hackathon in Oslo, Perl module toolchain maintainers agrees
+to use the CPAN Meta format to communicate post-configuration requirements
+between toolchain components.  These files, F<MYMETA.json> and F<MYMETA.yml>,
+are generated when F<Makefile.PL> generates a F<Makefile> (if L<CPAN::Meta>
+is installed).  Clients like L<CPAN> or L<CPANPLUS> will read this
+files to see what prerequisites must be fulfilled before building or testing
+the distribution.  If you with to shut this feature off, set the C<NO_MYMETA>
+C<WriteMakeFile()> flag to true.
 
 =head2 Disabling an extension
 
@@ -2812,6 +2851,8 @@ not normally available.
 L<ExtUtils::ModuleMaker> and L<Module::Starter> are both modules to
 help you setup your distribution.
 
+L<CPAN::Meta> and L<CPAN::Meta::Spec> explain CPAN Meta files in detail.
+
 =head1 AUTHORS
 
 Andy Dougherty C<doughera@lafayette.edu>, Andreas KE<ouml>nig
index a7ac47d..70ee092 100644 (file)
@@ -2,7 +2,7 @@ package ExtUtils::MakeMaker::Config;
 
 use strict;
 
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 use Config ();
 
index f335423..ae9cf1a 100644 (file)
@@ -1,6 +1,6 @@
 package ExtUtils::MakeMaker::FAQ;
 
-our $VERSION = '6.57_01';
+our $VERSION = '6.58';
 
 1;
 __END__
index d5ff908..dee1b10 100644 (file)
@@ -1,6 +1,6 @@
 package ExtUtils::MakeMaker::Tutorial;
 
-our $VERSION = 6.57_01;
+our $VERSION = 6.58;
 
 
 =head1 NAME
diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/YAML.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/YAML.pm
deleted file mode 100644 (file)
index 55ff6fd..0000000
+++ /dev/null
@@ -1,658 +0,0 @@
-package ExtUtils::MakeMaker::YAML;\r
-\r
-use strict;\r
-\r
-# UTF Support?\r
-sub HAVE_UTF8 () { $] >= 5.007003 }\r
-BEGIN {\r
-       if ( HAVE_UTF8 ) {\r
-               # The string eval helps hide this from Test::MinimumVersion\r
-               eval "require utf8;";\r
-               die "Failed to load UTF-8 support" if $@;\r
-       }\r
-\r
-       # Class structure\r
-       require 5.004;\r
-       require Exporter;\r
-       require Carp;\r
-       $ExtUtils::MakeMaker::YAML::VERSION   = '1.44';\r
-       @ExtUtils::MakeMaker::YAML::ISA       = qw{ Exporter  };\r
-       @ExtUtils::MakeMaker::YAML::EXPORT    = qw{ Load Dump };\r
-       @ExtUtils::MakeMaker::YAML::EXPORT_OK = qw{ LoadFile DumpFile freeze thaw };\r
-\r
-       # Error storage\r
-       $ExtUtils::MakeMaker::YAML::errstr    = '';\r
-}\r
-\r
-# The character class of all characters we need to escape\r
-# NOTE: Inlined, since it's only used once\r
-# my $RE_ESCAPE = '[\\x00-\\x08\\x0b-\\x0d\\x0e-\\x1f\"\n]';\r
-\r
-# Printed form of the unprintable characters in the lowest range\r
-# of ASCII characters, listed by ASCII ordinal position.\r
-my @UNPRINTABLE = qw(\r
-       z    x01  x02  x03  x04  x05  x06  a\r
-       x08  t    n    v    f    r    x0e  x0f\r
-       x10  x11  x12  x13  x14  x15  x16  x17\r
-       x18  x19  x1a  e    x1c  x1d  x1e  x1f\r
-);\r
-\r
-# Printable characters for escapes\r
-my %UNESCAPES = (\r
-       z => "\x00", a => "\x07", t    => "\x09",\r
-       n => "\x0a", v => "\x0b", f    => "\x0c",\r
-       r => "\x0d", e => "\x1b", '\\' => '\\',\r
-);\r
-\r
-# Special magic boolean words\r
-my %QUOTE = map { $_ => 1 } qw{\r
-       null Null NULL\r
-       y Y yes Yes YES n N no No NO\r
-       true True TRUE false False FALSE\r
-       on On ON off Off OFF\r
-};\r
-\r
-\r
-\r
-\r
-\r
-#####################################################################\r
-# Implementation\r
-\r
-# Create an empty ExtUtils::MakeMaker::YAML object\r
-sub new {\r
-       my $class = shift;\r
-       bless [ @_ ], $class;\r
-}\r
-\r
-# Create an object from a file\r
-sub read {\r
-       my $class = ref $_[0] ? ref shift : shift;\r
-\r
-       # Check the file\r
-       my $file = shift or return $class->_error( 'You did not specify a file name' );\r
-       return $class->_error( "File '$file' does not exist" )              unless -e $file;\r
-       return $class->_error( "'$file' is a directory, not a file" )       unless -f _;\r
-       return $class->_error( "Insufficient permissions to read '$file'" ) unless -r _;\r
-\r
-       # Slurp in the file\r
-       local $/ = undef;\r
-       local *CFG;\r
-       unless ( open(CFG, $file) ) {\r
-               return $class->_error("Failed to open file '$file': $!");\r
-       }\r
-       my $contents = <CFG>;\r
-       unless ( close(CFG) ) {\r
-               return $class->_error("Failed to close file '$file': $!");\r
-       }\r
-\r
-       $class->read_string( $contents );\r
-}\r
-\r
-# Create an object from a string\r
-sub read_string {\r
-       my $class  = ref $_[0] ? ref shift : shift;\r
-       my $self   = bless [], $class;\r
-       my $string = $_[0];\r
-       unless ( defined $string ) {\r
-               return $self->_error("Did not provide a string to load");\r
-       }\r
-\r
-       # Byte order marks\r
-       # NOTE: Keeping this here to educate maintainers\r
-       # my %BOM = (\r
-       #     "\357\273\277" => 'UTF-8',\r
-       #     "\376\377"     => 'UTF-16BE',\r
-       #     "\377\376"     => 'UTF-16LE',\r
-       #     "\377\376\0\0" => 'UTF-32LE'\r
-       #     "\0\0\376\377" => 'UTF-32BE',\r
-       # );\r
-       if ( $string =~ /^(?:\376\377|\377\376|\377\376\0\0|\0\0\376\377)/ ) {\r
-               return $self->_error("Stream has a non UTF-8 BOM");\r
-       } else {\r
-               # Strip UTF-8 bom if found, we'll just ignore it\r
-               $string =~ s/^\357\273\277//;\r
-       }\r
-\r
-       # Try to decode as utf8\r
-       utf8::decode($string) if HAVE_UTF8;\r
-\r
-       # Check for some special cases\r
-       return $self unless length $string;\r
-       unless ( $string =~ /[\012\015]+\z/ ) {\r
-               return $self->_error("Stream does not end with newline character");\r
-       }\r
-\r
-       # Split the file into lines\r
-       my @lines = grep { ! /^\s*(?:\#.*)?\z/ }\r
-                   split /(?:\015{1,2}\012|\015|\012)/, $string;\r
-\r
-       # Strip the initial YAML header\r
-       @lines and $lines[0] =~ /^\%YAML[: ][\d\.]+.*\z/ and shift @lines;\r
-\r
-       # A nibbling parser\r
-       while ( @lines ) {\r
-               # Do we have a document header?\r
-               if ( $lines[0] =~ /^---\s*(?:(.+)\s*)?\z/ ) {\r
-                       # Handle scalar documents\r
-                       shift @lines;\r
-                       if ( defined $1 and $1 !~ /^(?:\#.+|\%YAML[: ][\d\.]+)\z/ ) {\r
-                               push @$self, $self->_read_scalar( "$1", [ undef ], \@lines );\r
-                               next;\r
-                       }\r
-               }\r
-\r
-               if ( ! @lines or $lines[0] =~ /^(?:---|\.\.\.)/ ) {\r
-                       # A naked document\r
-                       push @$self, undef;\r
-                       while ( @lines and $lines[0] !~ /^---/ ) {\r
-                               shift @lines;\r
-                       }\r
-\r
-               } elsif ( $lines[0] =~ /^\s*\-/ ) {\r
-                       # An array at the root\r
-                       my $document = [ ];\r
-                       push @$self, $document;\r
-                       $self->_read_array( $document, [ 0 ], \@lines );\r
-\r
-               } elsif ( $lines[0] =~ /^(\s*)\S/ ) {\r
-                       # A hash at the root\r
-                       my $document = { };\r
-                       push @$self, $document;\r
-                       $self->_read_hash( $document, [ length($1) ], \@lines );\r
-\r
-               } else {\r
-                       Carp::croak("ExtUtils::MakeMaker::YAML failed to classify the line '$lines[0]'");\r
-               }\r
-       }\r
-\r
-       $self;\r
-}\r
-\r
-# Deparse a scalar string to the actual scalar\r
-sub _read_scalar {\r
-       my ($self, $string, $indent, $lines) = @_;\r
-\r
-       # Trim trailing whitespace\r
-       $string =~ s/\s*\z//;\r
-\r
-       # Explitic null/undef\r
-       return undef if $string eq '~';\r
-\r
-       # Single quote\r
-       if ( $string =~ /^\'(.*?)\'\z/ ) {\r
-               return '' unless defined $1;\r
-               $string = $1;\r
-               $string =~ s/\'\'/\'/g;\r
-               return $string;\r
-       }\r
-\r
-       # Double quote.\r
-       # The commented out form is simpler, but overloaded the Perl regex\r
-       # engine due to recursion and backtracking problems on strings\r
-       # larger than 32,000ish characters. Keep it for reference purposes.\r
-       # if ( $string =~ /^\"((?:\\.|[^\"])*)\"\z/ ) {\r
-       if ( $string =~ /^\"([^\\"]*(?:\\.[^\\"]*)*)\"\z/ ) {\r
-               # Reusing the variable is a little ugly,\r
-               # but avoids a new variable and a string copy.\r
-               $string = $1;\r
-               $string =~ s/\\"/"/g;\r
-               $string =~ s/\\([never\\fartz]|x([0-9a-fA-F]{2}))/(length($1)>1)?pack("H2",$2):$UNESCAPES{$1}/gex;\r
-               return $string;\r
-       }\r
-\r
-       # Special cases\r
-       if ( $string =~ /^[\'\"!&]/ ) {\r
-               Carp::croak("ExtUtils::MakeMaker::YAML does not support a feature in line '$lines->[0]'");\r
-       }\r
-       return {} if $string eq '{}';\r
-       return [] if $string eq '[]';\r
-\r
-       # Regular unquoted string\r
-       return $string unless $string =~ /^[>|]/;\r
-\r
-       # Error\r
-       Carp::croak("ExtUtils::MakeMaker::YAML failed to find multi-line scalar content") unless @$lines;\r
-\r
-       # Check the indent depth\r
-       $lines->[0]   =~ /^(\s*)/;\r
-       $indent->[-1] = length("$1");\r
-       if ( defined $indent->[-2] and $indent->[-1] <= $indent->[-2] ) {\r
-               Carp::croak("ExtUtils::MakeMaker::YAML found bad indenting in line '$lines->[0]'");\r
-       }\r
-\r
-       # Pull the lines\r
-       my @multiline = ();\r
-       while ( @$lines ) {\r
-               $lines->[0] =~ /^(\s*)/;\r
-               last unless length($1) >= $indent->[-1];\r
-               push @multiline, substr(shift(@$lines), length($1));\r
-       }\r
-\r
-       my $j = (substr($string, 0, 1) eq '>') ? ' ' : "\n";\r
-       my $t = (substr($string, 1, 1) eq '-') ? ''  : "\n";\r
-       return join( $j, @multiline ) . $t;\r
-}\r
-\r
-# Parse an array\r
-sub _read_array {\r
-       my ($self, $array, $indent, $lines) = @_;\r
-\r
-       while ( @$lines ) {\r
-               # Check for a new document\r
-               if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) {\r
-                       while ( @$lines and $lines->[0] !~ /^---/ ) {\r
-                               shift @$lines;\r
-                       }\r
-                       return 1;\r
-               }\r
-\r
-               # Check the indent level\r
-               $lines->[0] =~ /^(\s*)/;\r
-               if ( length($1) < $indent->[-1] ) {\r
-                       return 1;\r
-               } elsif ( length($1) > $indent->[-1] ) {\r
-                       Carp::croak("ExtUtils::MakeMaker::YAML found bad indenting in line '$lines->[0]'");\r
-               }\r
-\r
-               if ( $lines->[0] =~ /^(\s*\-\s+)[^\'\"]\S*\s*:(?:\s+|$)/ ) {\r
-                       # Inline nested hash\r
-                       my $indent2 = length("$1");\r
-                       $lines->[0] =~ s/-/ /;\r
-                       push @$array, { };\r
-                       $self->_read_hash( $array->[-1], [ @$indent, $indent2 ], $lines );\r
-\r
-               } elsif ( $lines->[0] =~ /^\s*\-(\s*)(.+?)\s*\z/ ) {\r
-                       # Array entry with a value\r
-                       shift @$lines;\r
-                       push @$array, $self->_read_scalar( "$2", [ @$indent, undef ], $lines );\r
-\r
-               } elsif ( $lines->[0] =~ /^\s*\-\s*\z/ ) {\r
-                       shift @$lines;\r
-                       unless ( @$lines ) {\r
-                               push @$array, undef;\r
-                               return 1;\r
-                       }\r
-                       if ( $lines->[0] =~ /^(\s*)\-/ ) {\r
-                               my $indent2 = length("$1");\r
-                               if ( $indent->[-1] == $indent2 ) {\r
-                                       # Null array entry\r
-                                       push @$array, undef;\r
-                               } else {\r
-                                       # Naked indenter\r
-                                       push @$array, [ ];\r
-                                       $self->_read_array( $array->[-1], [ @$indent, $indent2 ], $lines );\r
-                               }\r
-\r
-                       } elsif ( $lines->[0] =~ /^(\s*)\S/ ) {\r
-                               push @$array, { };\r
-                               $self->_read_hash( $array->[-1], [ @$indent, length("$1") ], $lines );\r
-\r
-                       } else {\r
-                               Carp::croak("ExtUtils::MakeMaker::YAML failed to classify line '$lines->[0]'");\r
-                       }\r
-\r
-               } elsif ( defined $indent->[-2] and $indent->[-1] == $indent->[-2] ) {\r
-                       # This is probably a structure like the following...\r
-                       # ---\r
-                       # foo:\r
-                       # - list\r
-                       # bar: value\r
-                       #\r
-                       # ... so lets return and let the hash parser handle it\r
-                       return 1;\r
-\r
-               } else {\r
-                       Carp::croak("ExtUtils::MakeMaker::YAML failed to classify line '$lines->[0]'");\r
-               }\r
-       }\r
-\r
-       return 1;\r
-}\r
-\r
-# Parse an array\r
-sub _read_hash {\r
-       my ($self, $hash, $indent, $lines) = @_;\r
-\r
-       while ( @$lines ) {\r
-               # Check for a new document\r
-               if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) {\r
-                       while ( @$lines and $lines->[0] !~ /^---/ ) {\r
-                               shift @$lines;\r
-                       }\r
-                       return 1;\r
-               }\r
-\r
-               # Check the indent level\r
-               $lines->[0] =~ /^(\s*)/;\r
-               if ( length($1) < $indent->[-1] ) {\r
-                       return 1;\r
-               } elsif ( length($1) > $indent->[-1] ) {\r
-                       Carp::croak("ExtUtils::MakeMaker::YAML found bad indenting in line '$lines->[0]'");\r
-               }\r
-\r
-               # Get the key\r
-               unless ( $lines->[0] =~ s/^\s*([^\'\" ][^\n]*?)\s*:(\s+|$)// ) {\r
-                       if ( $lines->[0] =~ /^\s*[?\'\"]/ ) {\r
-                               Carp::croak("ExtUtils::MakeMaker::YAML does not support a feature in line '$lines->[0]'");\r
-                       }\r
-                       Carp::croak("ExtUtils::MakeMaker::YAML failed to classify line '$lines->[0]'");\r
-               }\r
-               my $key = $1;\r
-\r
-               # Do we have a value?\r
-               if ( length $lines->[0] ) {\r
-                       # Yes\r
-                       $hash->{$key} = $self->_read_scalar( shift(@$lines), [ @$indent, undef ], $lines );\r
-               } else {\r
-                       # An indent\r
-                       shift @$lines;\r
-                       unless ( @$lines ) {\r
-                               $hash->{$key} = undef;\r
-                               return 1;\r
-                       }\r
-                       if ( $lines->[0] =~ /^(\s*)-/ ) {\r
-                               $hash->{$key} = [];\r
-                               $self->_read_array( $hash->{$key}, [ @$indent, length($1) ], $lines );\r
-                       } elsif ( $lines->[0] =~ /^(\s*)./ ) {\r
-                               my $indent2 = length("$1");\r
-                               if ( $indent->[-1] >= $indent2 ) {\r
-                                       # Null hash entry\r
-                                       $hash->{$key} = undef;\r
-                               } else {\r
-                                       $hash->{$key} = {};\r
-                                       $self->_read_hash( $hash->{$key}, [ @$indent, length($1) ], $lines );\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-\r
-       return 1;\r
-}\r
-\r
-# Save an object to a file\r
-sub write {\r
-       my $self = shift;\r
-       my $file = shift or return $self->_error('No file name provided');\r
-\r
-       # Write it to the file\r
-       open( CFG, '>' . $file ) or return $self->_error(\r
-               "Failed to open file '$file' for writing: $!"\r
-               );\r
-       print CFG $self->write_string;\r
-       close CFG;\r
-\r
-       return 1;\r
-}\r
-\r
-# Save an object to a string\r
-sub write_string {\r
-       my $self = shift;\r
-       return '' unless @$self;\r
-\r
-       # Iterate over the documents\r
-       my $indent = 0;\r
-       my @lines  = ();\r
-       foreach my $cursor ( @$self ) {\r
-               push @lines, '---';\r
-\r
-               # An empty document\r
-               if ( ! defined $cursor ) {\r
-                       # Do nothing\r
-\r
-               # A scalar document\r
-               } elsif ( ! ref $cursor ) {\r
-                       $lines[-1] .= ' ' . $self->_write_scalar( $cursor, $indent );\r
-\r
-               # version object\r
-               } elsif ( ref $cursor eq 'version' ) {\r
-                       $lines[-1] .= ' ' . $self->_write_scalar( $cursor->stringify, $indent );\r
-\r
-               # A list at the root\r
-               } elsif ( ref $cursor eq 'ARRAY' ) {\r
-                       unless ( @$cursor ) {\r
-                               $lines[-1] .= ' []';\r
-                               next;\r
-                       }\r
-                       push @lines, $self->_write_array( $cursor, $indent, {} );\r
-\r
-               # A hash at the root\r
-               } elsif ( ref $cursor eq 'HASH' ) {\r
-                       unless ( %$cursor ) {\r
-                               $lines[-1] .= ' {}';\r
-                               next;\r
-                       }\r
-                       push @lines, $self->_write_hash( $cursor, $indent, {} );\r
-\r
-               } else {\r
-                       Carp::croak("Cannot serialize " . ref($cursor));\r
-               }\r
-       }\r
-\r
-       join '', map { "$_\n" } @lines;\r
-}\r
-\r
-sub _write_scalar {\r
-       my $string = $_[1];\r
-       return '~'  unless defined $string;\r
-       return "''" unless length  $string;\r
-       if ( $string =~ /[\x00-\x08\x0b-\x0d\x0e-\x1f\"\'\n]/ ) {\r
-               $string =~ s/\\/\\\\/g;\r
-               $string =~ s/"/\\"/g;\r
-               $string =~ s/\n/\\n/g;\r
-               $string =~ s/([\x00-\x1f])/\\$UNPRINTABLE[ord($1)]/g;\r
-               return qq|"$string"|;\r
-       }\r
-       if ( $string =~ /(?:^\W|\s)/ or $QUOTE{$string} ) {\r
-               return "'$string'";\r
-       }\r
-       return $string;\r
-}\r
-\r
-sub _write_array {\r
-       my ($self, $array, $indent, $seen) = @_;\r
-       if ( $seen->{refaddr($array)}++ ) {\r
-               die "ExtUtils::MakeMaker::YAML does not support circular references";\r
-       }\r
-       my @lines  = ();\r
-       foreach my $el ( @$array ) {\r
-               my $line = ('  ' x $indent) . '-';\r
-               my $type = ref $el;\r
-               if ( ! $type ) {\r
-                       $line .= ' ' . $self->_write_scalar( $el, $indent + 1 );\r
-                       push @lines, $line;\r
-\r
-               # version object\r
-               } elsif ( $type eq 'version' ) {\r
-                       $line .= ' ' . $self->_write_scalar( $el->stringify, $indent + 1 );\r
-                       push @lines, $line;\r
-\r
-               } elsif ( $type eq 'ARRAY' ) {\r
-                       if ( @$el ) {\r
-                               push @lines, $line;\r
-                               push @lines, $self->_write_array( $el, $indent + 1, $seen );\r
-                       } else {\r
-                               $line .= ' []';\r
-                               push @lines, $line;\r
-                       }\r
-\r
-               } elsif ( $type eq 'HASH' ) {\r
-                       if ( keys %$el ) {\r
-                               push @lines, $line;\r
-                               push @lines, $self->_write_hash( $el, $indent + 1, $seen );\r
-                       } else {\r
-                               $line .= ' {}';\r
-                               push @lines, $line;\r
-                       }\r
-\r
-               } else {\r
-                       die "ExtUtils::MakeMaker::YAML does not support $type references";\r
-               }\r
-       }\r
-\r
-       @lines;\r
-}\r
-\r
-sub _write_hash {\r
-       my ($self, $hash, $indent, $seen) = @_;\r
-       if ( $seen->{refaddr($hash)}++ ) {\r
-               die "ExtUtils::MakeMaker::YAML does not support circular references";\r
-       }\r
-       my @lines  = ();\r
-       foreach my $name ( sort keys %$hash ) {\r
-               my $el   = $hash->{$name};\r
-               my $line = ('  ' x $indent) . "$name:";\r
-               my $type = ref $el;\r
-               if ( ! $type ) {\r
-                       $line .= ' ' . $self->_write_scalar( $el, $indent + 1 );\r
-                       push @lines, $line;\r
-\r
-               # version object\r
-               } elsif ( $type eq 'version' ) {\r
-                       $line .= ' ' . $self->_write_scalar( $el->stringify, $indent + 1 );\r
-                       push @lines, $line;\r
-\r
-               } elsif ( $type eq 'ARRAY' ) {\r
-                       if ( @$el ) {\r
-                               push @lines, $line;\r
-                               push @lines, $self->_write_array( $el, $indent + 1, $seen );\r
-                       } else {\r
-                               $line .= ' []';\r
-                               push @lines, $line;\r
-                       }\r
-\r
-               } elsif ( $type eq 'HASH' ) {\r
-                       if ( keys %$el ) {\r
-                               push @lines, $line;\r
-                               push @lines, $self->_write_hash( $el, $indent + 1, $seen );\r
-                       } else {\r
-                               $line .= ' {}';\r
-                               push @lines, $line;\r
-                       }\r
-\r
-               } else {\r
-                       die "ExtUtils::MakeMaker::YAML does not support $type references";\r
-               }\r
-       }\r
-\r
-       @lines;\r
-}\r
-\r
-# Set error\r
-sub _error {\r
-       $ExtUtils::MakeMaker::YAML::errstr = $_[1];\r
-       undef;\r
-}\r
-\r
-# Retrieve error\r
-sub errstr {\r
-       $ExtUtils::MakeMaker::YAML::errstr;\r
-}\r
-\r
-\r
-\r
-\r
-\r
-#####################################################################\r
-# YAML Compatibility\r
-\r
-sub Dump {\r
-       ExtUtils::MakeMaker::YAML->new(@_)->write_string;\r
-}\r
-\r
-sub Load {\r
-       my $self = ExtUtils::MakeMaker::YAML->read_string(@_);\r
-       unless ( $self ) {\r
-               Carp::croak("Failed to load YAML document from string");\r
-       }\r
-       if ( wantarray ) {\r
-               return @$self;\r
-       } else {\r
-               # To match YAML.pm, return the last document\r
-               return $self->[-1];\r
-       }\r
-}\r
-\r
-BEGIN {\r
-       *freeze = *Dump;\r
-       *thaw   = *Load;\r
-}\r
-\r
-sub DumpFile {\r
-       my $file = shift;\r
-       ExtUtils::MakeMaker::YAML->new(@_)->write($file);\r
-}\r
-\r
-sub LoadFile {\r
-       my $self = ExtUtils::MakeMaker::YAML->read($_[0]);\r
-       unless ( $self ) {\r
-               Carp::croak("Failed to load YAML document from '" . ($_[0] || '') . "'");\r
-       }\r
-       if ( wantarray ) {\r
-               return @$self;\r
-       } else {\r
-               # Return only the last document to match YAML.pm, \r
-               return $self->[-1];\r
-       }\r
-}\r
-\r
-\r
-\r
-\r
-\r
-#####################################################################\r
-# Use Scalar::Util if possible, otherwise emulate it\r
-\r
-BEGIN {\r
-       eval {\r
-               require Scalar::Util;\r
-               *refaddr = *Scalar::Util::refaddr;\r
-       };\r
-       eval <<'END_PERL' if $@;\r
-# Failed to load Scalar::Util  \r
-sub refaddr {\r
-       my $pkg = ref($_[0]) or return undef;\r
-       if (!!UNIVERSAL::can($_[0], 'can')) {\r
-               bless $_[0], 'Scalar::Util::Fake';\r
-       } else {\r
-               $pkg = undef;\r
-       }\r
-       "$_[0]" =~ /0x(\w+)/;\r
-       my $i = do { local $^W; hex $1 };\r
-       bless $_[0], $pkg if defined $pkg;\r
-       $i;\r
-}\r
-END_PERL\r
-\r
-}\r
-\r
-1;\r
-\r
-__END__\r
-\r
-=pod\r
-\r
-=head1 NAME\r
-\r
-ExtUtils::MakeMaker::YAML - clone of YAML::Tiny\r
-\r
-=head1 SYNOPSIS\r
-\r
-See L<YAML::Tiny>\r
-\r
-=head1 AUTHOR\r
-\r
-Adam Kennedy E<lt>adamk@cpan.orgE<gt>\r
-\r
-=head1 SEE ALSO\r
-\r
-L<YAML>, L<YAML::Syck>\r
-\r
-=head1 COPYRIGHT\r
-\r
-Copyright 2006 - 2010 Adam Kennedy.\r
-\r
-This program is free software; you can redistribute\r
-it and/or modify it under the same terms as Perl itself.\r
-\r
-=cut\r
index fbf2415..bc3bd34 100644 (file)
@@ -3,7 +3,7 @@ package ExtUtils::Mkbootstrap;
 # There's just too much Dynaloader incest here to turn on strict vars.
 use strict 'refs';
 
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 require Exporter;
 our @ISA = ('Exporter');
index 9aac3fd..e7ff00c 100644 (file)
@@ -10,7 +10,7 @@ use Config;
 
 our @ISA = qw(Exporter);
 our @EXPORT = qw(&Mksymlists);
-our $VERSION = '6.57_05';
+our $VERSION = '6.58';
 
 sub Mksymlists {
     my(%spec) = @_;
index 7314410..623e010 100644 (file)
@@ -3,7 +3,7 @@ package ExtUtils::testlib;
 use strict;
 use warnings;
 
-our $VERSION = 6.57_05;
+our $VERSION = '6.58';
 
 use Cwd;
 use File::Spec;
index d627fb1..cdec1b9 100644 (file)
@@ -12,7 +12,11 @@ BEGIN {
     $Has_Test_Pod = eval 'use Test::Pod 0.95; 1';
 }
 
+plan skip_all => 'No MANIFEST'
+  unless -e "../MANIFEST";
+  
 chdir "..";
+
 my $manifest = "MANIFEST";
 open(my $manifest_fh, "<", $manifest) or die "Can't open $manifest: $!";
 my @modules = map  { m{^lib/(\S+)}; $1 } 
index 6aac294..b5ece3e 100644 (file)
@@ -46,12 +46,12 @@ my $mm = WriteMakefile(
 );
 like( $stdout->read, qr{
                         Writing\ $Makefile\ for\ Big::Liar\n
-                        Writing\ MYMETA.yml\n
+                        (?:Writing\ MYMETA.yml\ and\ MYMETA.json\n)?
                         Big::Liar's\ vars\n
                         INST_LIB\ =\ \S+\n
                         INST_ARCHLIB\ =\ \S+\n
                         Writing\ $Makefile\ for\ Big::Dummy\n
-                        Writing\ MYMETA.yml\n
+                        (?:Writing\ MYMETA.yml\ and\ MYMETA.json\n)?
 }x );
 undef $stdout;
 untie *STDOUT;
@@ -128,12 +128,12 @@ $mm = WriteMakefile(
 );
 like( $stdout->read, qr{
                         Writing\ $Makefile\ for\ Big::Liar\n
-                       Writing\ MYMETA.yml\n
+                        (?:Writing\ MYMETA.yml\ and\ MYMETA.json\n)?
                         Big::Liar's\ vars\n
                         INST_LIB\ =\ \S+\n
                         INST_ARCHLIB\ =\ \S+\n
                         Writing\ $Makefile\ for\ Big::Dummy\n
-                       Writing\ MYMETA.yml\n
+                        (?:Writing\ MYMETA.yml\ and\ MYMETA.json\n)?
 }x );
 undef $stdout;
 untie *STDOUT;
index fbb18a3..5bd0a5d 100644 (file)
@@ -50,12 +50,12 @@ my $mm = WriteMakefile(
 
 like( $stdout->read, qr{
                         Writing\ $Makefile\ for\ Big::Liar\n
-                       Writing\ MYMETA.yml\n
+                        (?:Writing\ MYMETA.yml\ and\ MYMETA.json\n)?
                         Big::Liar's\ vars\n
                         INST_LIB\ =\ \S+\n
                         INST_ARCHLIB\ =\ \S+\n
                         Writing\ $Makefile\ for\ Big::Dummy\n
-                       Writing\ MYMETA.yml\n
+                        (?:Writing\ MYMETA.yml\ and\ MYMETA.json\n)?
 }x );
 
 is( $mm->{PREFIX}, '$(SITEPREFIX)', 'PREFIX set based on INSTALLDIRS' );
@@ -80,12 +80,12 @@ $mm = WriteMakefile(
 );
 like( $stdout->read, qr{
                         Writing\ $Makefile\ for\ Big::Liar\n
-                       Writing\ MYMETA.yml\n
+                        (?:Writing\ MYMETA.yml\ and\ MYMETA.json\n)?
                         Big::Liar's\ vars\n
                         INST_LIB\ =\ \S+\n
                         INST_ARCHLIB\ =\ \S+\n
                         Writing\ $Makefile\ for\ Big::Dummy\n
-                       Writing\ MYMETA.yml\n
+                        (?:Writing\ MYMETA.yml\ and\ MYMETA.json\n)?
 }x );
 undef $stdout;
 untie *STDOUT;
diff --git a/cpan/ExtUtils-MakeMaker/t/META_for_testing.json b/cpan/ExtUtils-MakeMaker/t/META_for_testing.json
new file mode 100644 (file)
index 0000000..c0ba55b
--- /dev/null
@@ -0,0 +1,60 @@
+{
+   "abstract" : "Create a module Makefile",
+   "author" : [
+      "Michael G Schwern <schwern@pobox.com>"
+   ],
+   "dynamic_config" : 1,
+   "generated_by" : "ExtUtils::MakeMaker version 6.5707, CPAN::Meta::Converter version 2.110580",
+   "license" : [
+      "perl_5"
+   ],
+   "meta-spec" : {
+      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+      "version" : "2"
+   },
+   "name" : "ExtUtils-MakeMaker",
+   "no_index" : {
+      "directory" : [
+         "t",
+         "inc"
+      ],
+      "package" : [
+         "DynaLoader",
+         "in"
+      ]
+   },
+   "prereqs" : {
+      "build" : {
+         "requires" : {
+            "Data::Dumper" : 0
+         }
+      },
+      "configure" : {
+         "requires" : {}
+      },
+      "runtime" : {
+         "requires" : {
+            "DirHandle" : 0,
+            "File::Basename" : 0,
+            "File::Spec" : "0.8",
+            "Pod::Man" : 0,
+            "perl" : "5.006"
+         }
+      }
+   },
+   "release_status" : "testing",
+   "resources" : {
+      "bugtracker" : {
+         "web" : "http://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker"
+      },
+      "homepage" : "http://makemaker.org",
+      "license" : [
+         "http://dev.perl.org/licenses/"
+      ],
+      "repository" : {
+         "url" : "http://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker"
+      },
+      "x_MailingList" : "makemaker@perl.org"
+   },
+   "version" : "6.57_07"
+}
diff --git a/cpan/ExtUtils-MakeMaker/t/META_for_testing.yml b/cpan/ExtUtils-MakeMaker/t/META_for_testing.yml
new file mode 100644 (file)
index 0000000..bda66a1
--- /dev/null
@@ -0,0 +1,34 @@
+---
+abstract: 'Create a module Makefile'
+author:
+  - 'Michael G Schwern <schwern@pobox.com>'
+build_requires:
+  Data::Dumper: 0
+configure_requires: {}
+dynamic_config: 1
+generated_by: 'ExtUtils::MakeMaker version 6.5707, CPAN::Meta::Converter version 2.110580'
+license: perl
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
+name: ExtUtils-MakeMaker
+no_index:
+  directory:
+    - t
+    - inc
+  package:
+    - DynaLoader
+    - in
+requires:
+  DirHandle: 0
+  File::Basename: 0
+  File::Spec: 0.8
+  Pod::Man: 0
+  perl: 5.006
+resources:
+  bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker
+  homepage: http://makemaker.org
+  license: http://dev.perl.org/licenses/
+  repository: http://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker
+  x_MailingList: makemaker@perl.org
+version: 6.57_07
diff --git a/cpan/ExtUtils-MakeMaker/t/META_for_testing_tricky_version.yml b/cpan/ExtUtils-MakeMaker/t/META_for_testing_tricky_version.yml
new file mode 100644 (file)
index 0000000..04d809a
--- /dev/null
@@ -0,0 +1,23 @@
+--- #YAML:1.0
+name:               GD-Barcode-Code93
+version:            1.4
+abstract:           Code 93 implementation of GD::Barcode family
+author:
+    - Chris DiMartino
+license:            unknown
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
+requires:
+    GD:           0
+    GD::Barcode:  0
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.55_02
+meta-spec:
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4
index 39475ae..98601d6 100644 (file)
@@ -10,7 +10,7 @@ use Test::More;
 
 BEGIN {
        if ($^O =~ /MSWin32/i) {
-               plan tests => 49;
+               plan tests => 61;
        } else {
                plan skip_all => 'This is not Win32';
        }
@@ -272,6 +272,100 @@ unlink "${script_name}$script_ext" if -f "${script_name}$script_ext";
     is( $MM->pasthru(), $pastru, 'pasthru()' );
 }
 
+# _identify_compiler_environment()
+{
+       sub _run_cc_id {
+               my ( $config ) = @_;
+
+               $config->{cc} ||= '';
+
+               my @cc_env = ExtUtils::MM_Win32::_identify_compiler_environment( $config );
+
+               my %cc_env = ( BORLAND => $cc_env[0], GCC => $cc_env[1], DLLTOOL => $cc_env[2] );
+
+               return \%cc_env;
+       }
+
+       sub _check_cc_id_value {
+               my ( $test ) = @_;
+
+               my $res = _run_cc_id( $test->{config} );
+
+               fail( "unknown key '$test->{key}'" ) if !exists $res->{$test->{key}};
+               my $val = $res->{$test->{key}};
+
+               is( $val, $test->{expect}, $test->{desc} );
+
+               return;
+       }
+
+       my @tests = (
+               {
+                       config => {},
+                       key => 'DLLTOOL', expect => 'dlltool',
+                       desc => 'empty dlltool defaults to "dlltool"',
+               },
+               {
+                       config => { dlltool => 'test' },
+                       key => 'DLLTOOL', expect => 'test',
+                       desc => 'dlltool value is taken over verbatim from %Config, if set',
+               },
+               {
+                       config => {},
+                       key => 'GCC', expect => 0,
+                       desc => 'empty cc is not recognized as gcc',
+               },
+               {
+                       config => { cc => 'gcc' },
+                       key => 'GCC', expect => 1,
+                       desc => 'plain "gcc" is recognized',
+               },
+               {
+                       config => { cc => 'C:/MinGW/bin/gcc.exe' },
+                       key => 'GCC', expect => 1,
+                       desc => 'fully qualified "gcc" is recognized',
+               },
+               {
+                       config => { cc => 'C:/MinGW/bin/gcc-1.exe' },
+                       key => 'GCC', expect => 1,
+                       desc => 'dash-extended gcc is recognized',
+               },
+               {
+                       config => { cc => 'C:/MinGW/bin/gcc_1.exe' },
+                       key => 'GCC', expect => 0,
+                       desc => 'underscore-extended gcc is not recognized',
+               },
+               {
+                       config => {},
+                       key => 'BORLAND', expect => 0,
+                       desc => 'empty cc is not recognized as borland',
+               },
+               {
+                       config => { cc => 'bcc' },
+                       key => 'BORLAND', expect => 1,
+                       desc => 'plain "bcc" is recognized',
+               },
+               {
+                       config => { cc => 'C:/Borland/bin/bcc.exe' },
+                       key => 'BORLAND', expect => 0,
+                       desc => 'fully qualified borland cc is not recognized',
+               },
+               {
+                       config => { cc => 'bcc-1.exe' },
+                       key => 'BORLAND', expect => 1,
+                       desc => 'dash-extended borland cc is recognized',
+               },
+               {
+                       config => { cc => 'bcc_1.exe' },
+                       key => 'BORLAND', expect => 1,
+                       desc => 'underscore-extended borland cc is recognized',
+               },
+       );
+
+       _check_cc_id_value($_) for @tests;
+
+}
+
 package FakeOut;
 
 sub TIEHANDLE {
index 9cd1d93..64b3017 100644 (file)
@@ -11,7 +11,7 @@ use strict;
 use Config;
 use ExtUtils::MakeMaker;
 
-use Test::More tests => 98;
+use Test::More tests => 171;
 use MakeMaker::Test::Utils;
 use MakeMaker::Test::Setup::BFD;
 use File::Find;
@@ -31,8 +31,8 @@ $| = 1;
 
 ok( setup_recurs(), 'setup' );
 END {
-    ok( chdir File::Spec->updir );
-    ok( teardown_recurs(), 'teardown' );
+    ok chdir File::Spec->updir or die;
+    ok teardown_recurs, "teardown";
 }
 
 ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy" ) ||
@@ -230,123 +230,162 @@ my $distdir  = 'Big-Dummy-0.01';
 $distdir =~ s/\./_/g if $Is_VMS;
 my $meta_yml = "$distdir/META.yml";
 my $mymeta_yml = "$distdir/MYMETA.yml";
-
-ok( !-f 'META.yml',  'META.yml not written to source dir' );
-ok( -f $meta_yml,    'META.yml written to dist dir' );
-ok( !-e "META_new.yml", 'temp META.yml file not left around' );
-
-ok( -f 'MYMETA.yml',  'MYMETA.yml is written to source dir' );
-ok( -f $mymeta_yml,    'MYMETA.yml is written to dist dir on disttest' );
+my $meta_json = "$distdir/META.json";
+my $mymeta_json = "$distdir/MYMETA.json";
 
 SKIP: {
-    # META.yml spec 1.4 was added in 0.11
-    skip "Test::YAML::Meta >= 0.11 required", 4
-      unless eval { require Test::YAML::Meta }   and
-             Test::YAML::Meta->VERSION >= 0.11;
-
-    Test::YAML::Meta::meta_spec_ok($meta_yml);
-    Test::YAML::Meta::meta_spec_ok($mymeta_yml);
-}
-
-ok open META, $meta_yml or diag $!;
-my $meta = join '', <META>;
-ok close META;
-
-is $meta, <<"END";
---- #YAML:1.0
-name:               Big-Dummy
-version:            0.01
-abstract:           Try "our" hot dog's
-author:
-    - Michael G Schwern <schwern\@pobox.com>
-license:            unknown
-distribution_type:  module
-configure_requires:
-    ExtUtils::MakeMaker:  0
-build_requires:
-    warnings:  0
-requires:
-    strict:  0
-no_index:
-    directory:
-        - t
-        - inc
-generated_by:       ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION
-meta-spec:
-    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
-    version:  1.4
-END
-
-my $mymeta_expected_content=<<"END";
----
-abstract: "Try \\"our\\" hot dog's"
-author:
-  - 'Michael G Schwern <schwern\@pobox.com>'
-build_requires:
-  warnings: 0
-configure_requires:
-  ExtUtils::MakeMaker: 0
-distribution_type: module
-dynamic_config: 0
-generated_by: 'ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION'
-license: unknown
-meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
-name: Big-Dummy
-no_index:
-  directory:
-    - t
-    - inc
-requires:
-  strict: 0
-version: 0.01
-END
-
-{
-ok open META, $mymeta_yml or diag $!;
-my $mymeta_content = join '', <META>;
-ok close META;
-
-is($mymeta_content,$mymeta_expected_content,"MYMETA.yml (using Parse::CPAN::Meta) content is correct");
-}
-
-{
-ok open META, 'MYMETA.yml' or diag $!;
-my $mymeta_content = join '', <META>;
-ok close META;
+    skip "CPAN::Meta required", 104 unless eval { require CPAN::Meta };
+
+    ok( !-f 'META.yml',  'META.yml not written to source dir' );
+    ok( -f $meta_yml,    'META.yml written to dist dir' );
+    ok( !-e "META_new.yml", 'temp META.yml file not left around' );
+
+    ok( -f 'MYMETA.yml',  'MYMETA.yml is written to source dir' );
+    ok( -f $mymeta_yml,    'MYMETA.yml is written to dist dir on disttest' );
+
+    ok( !-f 'META.json',  'META.json not written to source dir' );
+    ok( -f $meta_json,    'META.json written to dist dir' );
+    ok( !-e "META_new.json", 'temp META.json file not left around' );
+
+    ok( -f 'MYMETA.json',  'MYMETA.json is written to source dir' );
+    ok( -f $mymeta_json,    'MYMETA.json is written to dist dir on disttest' );
+
+    for my $case (
+      ['META.yml', $meta_yml],
+      ['MYMETA.yml', $mymeta_yml],
+      ['META.json', $meta_json],
+      ['MYMETA.json', $mymeta_json],
+      ['MYMETA.yml', 'MYMETA.yml'],
+      ['MYMETA.json', 'MYMETA.json'],
+    ) {
+      my ($label, $meta_name) = @$case;
+      ok(
+        my $obj = eval {
+          CPAN::Meta->load_file($meta_name, {lazy_validation => 0})
+        },
+        "$label validates"
+      );
+      my $is = sub {
+        my ($m,$e) = @_;
+        is($obj->$m, $e, "$label -> $m")
+      };
+      my $is_list = sub {
+        my ($m,$e) = @_;
+        is_deeply([$obj->$m], $e, "$label -> $m")
+      };
+      my $is_map = sub {
+        my ($m,$e) = @_;
+        is_deeply($obj->$m, $e, "$label -> $m")
+      };
+      $is->( name => "Big-Dummy" );
+      $is->( version => "0.01" );
+      $is->( abstract => q{Try "our" hot dog's} );
+      $is_list->( licenses => [q{unknown}] );
+      $is_list->( authors => [ q{Michael G Schwern <schwern@pobox.com>} ] );
+      $is_map->( prereqs => {
+          configure => {
+            requires => {
+              'ExtUtils::MakeMaker' => 0
+            },
+          },
+          build => {
+            requires => {
+              'warnings' => 0
+            }
+          },
+          runtime => {
+            requires => {
+              'strict' => 0
+            }
+          },
+        }
+      );
+      $is_map->(
+        no_index => {
+          directory => [qw/t inc/],
+        }
+      );
+      $is->( dynamic_config => ($label =~ /MYMETA/) ? 0 : 1 );
+    }
 
-is($mymeta_content,$mymeta_expected_content,"MYMETA.yml (generated from scratch)content is correct");
+    my $manifest = maniread("$distdir/MANIFEST");
+    # VMS is non-case preserving, so we can't know what the MANIFEST will
+    # look like. :(
+    _normalize($manifest);
+    is( $manifest->{'meta.yml'}, 'Module YAML meta-data (added by MakeMaker)',
+      "MANIFEST has META.yml"
+    );
+    is( $manifest->{'meta.json'}, 'Module JSON meta-data (added by MakeMaker)',
+      "MANFIEST has META.json"
+    );
+
+    # Test NO_META META.yml suppression
+    for my $f ( $meta_yml, $meta_json, 'MYMETA.yml', 'MYMETA.json' ) {
+      1 while unlink $f;
+    }
+    ok( !-f $meta_yml,   'META.yml deleted' );
+    ok( !-f 'MYMETA.yml','MYMETA.yml deleted' );
+    ok( !-f $meta_json,   'META.json deleted' );
+    ok( !-f 'MYMETA.json','MYMETA.json deleted' );
+
+    @mpl_out = run(qq{$perl Makefile.PL "NO_META=1"});
+    ok( -f 'MYMETA.yml', 'MYMETA.yml generation not suppressed by NO_META' );
+    ok( -f 'MYMETA.json', 'MYMETA.json generation not suppressed by NO_META' );
+    cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out);
+    ok( !-f $meta_yml,   'META.yml generation suppressed by NO_META' );
+    ok( !-f $meta_json,   'META.json generation suppressed by NO_META' );
+    my $distdir_out = run("$make distdir");
+    is( $?, 0, 'distdir' ) || diag($distdir_out);
+    ok( !-f $meta_yml,   'META.yml generation suppressed by NO_META' );
+    ok( !-f $meta_json,   'META.json generation suppressed by NO_META' );
+
+    for my $f ( 'MYMETA.yml', 'MYMETA.json' ) {
+      1 while unlink $f;
+    }
+    ok( !-f 'MYMETA.yml','MYMETA.yml deleted' );
+    ok( !-f 'MYMETA.json','MYMETA.json deleted' );
+
+    @mpl_out = run(qq{$perl Makefile.PL "NO_MYMETA=1"});
+    cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out);
+    $distdir_out = run("$make distdir");
+    is( $?, 0, 'distdir' ) || diag($distdir_out);
+    ok( !-f 'MYMETA.yml','MYMETA.yml generation suppressed by NO_MYMETA' );
+    ok( !-f 'MYMETA.json','MYMETA.json generation suppressed by NO_MYMETA' );
+    ok( -f $meta_yml,    'META.yml generation not suppressed by NO_MYMETA' );
+    ok( -f $meta_json,    'META.json generation not suppressed by NO_MYMETA' );
+
+    # Test MYMETA really comes from META except for prereqs
+    for my $f ( $meta_yml, $meta_json, 'MYMETA.yml', 'MYMETA.json' ) {
+      1 while unlink $f;
+    }
+    @mpl_out = run(qq{$perl Makefile.PL});
+    cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out);
+    $distdir_out = run("$make distdir");
+    is( $?, 0, 'distdir' ) || diag($distdir_out);
+    ok( -f $meta_yml,    'META.yml generated in distdir' );
+    ok( -f $meta_json,    'META.json generated in distdir' );
+    ok( ! -f $mymeta_yml,    'MYMETA.yml not yet generated in distdir' );
+    ok( ! -f $mymeta_json,    'MYMETA.json generated in distdir' );
+    my $edit_meta = CPAN::Meta->load_file($meta_json)->as_struct;
+    $edit_meta->{abstract} = "New abstract";
+    my $meta_obj = CPAN::Meta->new($edit_meta);
+    is( $meta_obj->abstract, "New abstract", "MYMETA abstract from META, not Makefile.PL");
+    ok( $meta_obj->save($meta_json), "Saved edited META.json in distdir" );
+    ok( $meta_obj->save($meta_yml, {version => 1.4}), "Saved edited META.yml in distdir");
+    ok( chdir $distdir );
+    ok( -f 'META.yml',    'META.yml confirmed in distdir' );
+    ok( -f 'META.json',    'META.json confirmed in distdir' );
+    @mpl_out = run(qq{$perl Makefile.PL});
+    cmp_ok( $?, '==', 0, 'Makefile.PL in distdir exited with zero' ) || diag(@mpl_out);
+    ok( chdir File::Spec->updir );
+    ok( -f $mymeta_yml,    'MYMETA.yml generated in distdir' );
+    ok( -f $mymeta_json,    'MYMETA.json generated in distdir' );
+    $meta_obj = CPAN::Meta->load_file($meta_json);
+    is( $meta_obj->abstract, "New abstract", "META abstract is same as was saved");
+    $meta_obj = CPAN::Meta->load_file($mymeta_json);
+    is( $meta_obj->abstract, "New abstract", "MYMETA abstract from META, not Makefile.PL");
 }
 
-my $manifest = maniread("$distdir/MANIFEST");
-# VMS is non-case preserving, so we can't know what the MANIFEST will
-# look like. :(
-_normalize($manifest);
-is( $manifest->{'meta.yml'}, 'Module meta-data (added by MakeMaker)' );
-
-
-# Test NO_META META.yml suppression
-unlink $meta_yml;
-unlink 'MYMETA.yml';
-ok( !-f $meta_yml,   'META.yml deleted' );
-ok( !-f 'MYMETA.yml','MYMETA.yml deleted' );
-@mpl_out = run(qq{$perl Makefile.PL "NO_META=1"});
-ok( -f 'MYMETA.yml', 'MYMETA.yml generation not suppressed by NO_META' );
-cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out);
-ok( !-f $meta_yml,   'META.yml generation suppressed by NO_META' );
-my $distdir_out = run("$make distdir");
-is( $?, 0, 'distdir' ) || diag($distdir_out);
-ok( !-f $meta_yml,   'META.yml generation suppressed by NO_META' );
-unlink 'MYMETA.yml';
-
-ok( !-f 'MYMETA.yml','MYMETA.yml deleted' );
-@mpl_out = run(qq{$perl Makefile.PL "NO_MYMETA=1"});
-cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out);
-$distdir_out = run("$make distdir");
-is( $?, 0, 'distdir' ) || diag($distdir_out);
-ok( !-f 'MYMETA.yml','MYMETA.yml generation suppressed by NO_MYMETA' );
-ok( -f $meta_yml,    'META.yml generation not suppressed by NO_MYMETA' );
 
 
 # Make sure init_dirscan doesn't go into the distdir
index a8d31e1..04d9bd3 100644 (file)
@@ -1,67 +1,67 @@
-package MakeMaker::Test::Setup::SAS;\r
-\r
-@ISA = qw(Exporter);\r
-require Exporter;\r
-@EXPORT = qw(setup_recurs teardown_recurs);\r
-\r
-use strict;\r
-use File::Path;\r
-use File::Basename;\r
-\r
-our $dirname='Multiple-Authors';\r
-my %Files = (\r
-             $dirname.'/Makefile.PL'   => <<'END',\r
-use ExtUtils::MakeMaker;\r
-\r
-WriteMakefile(\r
-    NAME             => 'Multiple::Authors',\r
-    AUTHOR           => ['John Doe <jd@example.com>', 'Jane Doe <jd@example.com>'],\r
-    VERSION_FROM     => 'lib/Multiple/Authors.pm',\r
-    PREREQ_PM        => { strict => 0 },\r
-);\r
-END\r
-\r
-             $dirname.'/lib/Multiple/Authors.pm'    => <<'END',\r
-package Multiple::Authors;\r
-\r
-$VERSION = 0.05;\r
-\r
-=head1 NAME\r
-\r
-Multiple::Authors - several authors\r
-\r
-=cut\r
-\r
-1;\r
-END\r
-\r
-);\r
-\r
-\r
-sub setup_recurs {\r
-    while(my($file, $text) = each %Files) {\r
-        # Convert to a relative, native file path.\r
-        $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);\r
-\r
-        my $dir = dirname($file);\r
-        mkpath $dir;\r
-        open(FILE, ">$file") || die "Can't create $file: $!";\r
-        print FILE $text;\r
-        close FILE;\r
-    }\r
-\r
-    return 1;\r
-}\r
-\r
-sub teardown_recurs {\r
-    foreach my $file (keys %Files) {\r
-        my $dir = dirname($file);\r
-        if( -e $dir ) {\r
-            rmtree($dir) || return;\r
-        }\r
-    }\r
-    return 1;\r
-}\r
-\r
-\r
-1;\r
+package MakeMaker::Test::Setup::SAS;
+
+@ISA = qw(Exporter);
+require Exporter;
+@EXPORT = qw(setup_recurs teardown_recurs);
+
+use strict;
+use File::Path;
+use File::Basename;
+
+our $dirname='Multiple-Authors';
+my %Files = (
+             $dirname.'/Makefile.PL'   => <<'END',
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+    NAME             => 'Multiple::Authors',
+    AUTHOR           => ['John Doe <jd@example.com>', 'Jane Doe <jd@example.com>'],
+    VERSION_FROM     => 'lib/Multiple/Authors.pm',
+    PREREQ_PM        => { strict => 0 },
+);
+END
+
+             $dirname.'/lib/Multiple/Authors.pm'    => <<'END',
+package Multiple::Authors;
+
+$VERSION = 0.05;
+
+=head1 NAME
+
+Multiple::Authors - several authors
+
+=cut
+
+1;
+END
+
+);
+
+
+sub setup_recurs {
+    while(my($file, $text) = each %Files) {
+        # Convert to a relative, native file path.
+        $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);
+
+        my $dir = dirname($file);
+        mkpath $dir;
+        open(FILE, ">$file") || die "Can't create $file: $!";
+        print FILE $text;
+        close FILE;
+    }
+
+    return 1;
+}
+
+sub teardown_recurs {
+    foreach my $file (keys %Files) {
+        my $dir = dirname($file);
+        if( -e $dir ) {
+            rmtree($dir) || return;
+        }
+    }
+    return 1;
+}
+
+
+1;
diff --git a/cpan/ExtUtils-MakeMaker/t/meta_convert.t b/cpan/ExtUtils-MakeMaker/t/meta_convert.t
new file mode 100644 (file)
index 0000000..84875ba
--- /dev/null
@@ -0,0 +1,127 @@
+BEGIN {
+    chdir '..' if -d '../t';
+    unshift @INC, 't/lib';
+    use lib 'lib';
+}
+
+use strict;
+use warnings;
+use Test::More 'no_plan';
+
+require ExtUtils::MM_Any;
+
+sub ExtUtils::MM_Any::quote_literal { $_[1] }
+
+my $new_mm = sub {
+    return bless { ARGS => {@_}, @_ }, 'ExtUtils::MM_Any';
+};
+
+my $warn_ok = sub {
+    my($code, $want, $name) = @_;
+
+    my @have;
+    my $ret;
+    {
+        local $SIG{__WARN__} = sub { push @have, @_ };
+        $ret = $code->();
+    }
+
+    like join("", @have), $want, $name;
+    return $ret;
+};
+
+my $version_regex = qr/version: ''/;
+my $version_action = "they're converted to empty string";
+
+
+note "Filename as version"; {
+    my $mm = $new_mm->(
+        DISTNAME => 'Net::FTP::Recursive',
+        VERSION  => 'Recursive.pm',
+    );
+
+    my $res = $warn_ok->(
+        sub { eval { $mm->metafile_target } },
+        qr{Can't parse version 'Recursive.pm'}
+    );
+    ok $res, 'we know how to deal with bogus versions defined in Makefile.PL';
+    like $res, $version_regex, $version_action;
+}
+
+
+note "'undef' version from parse_version"; {
+    my $mm = $new_mm->(
+        DISTNAME => 'Image::Imgur',
+        VERSION  => 'undef',
+    );
+    my $res = $warn_ok->(
+        sub { eval { $mm->metafile_target } },
+        qr{Can't parse version 'undef'}
+    );
+    ok $res, q|when there's no $VERSION in Module.pm, $self->{VERSION} = 'undef'; via MM_Unix::parse_version and we know how to deal with that|;
+    like $res, $version_regex, $version_action;
+}
+
+
+note "x.y.z version"; {
+    my $mm = $new_mm->(
+        DISTNAME => 'SQL::Library',
+        VERSION  => 0.0.3,
+    );
+
+    # It would be more useful if the warning got translated to visible characters
+    my $res = $warn_ok->(
+        sub { eval { $mm->metafile_target } },
+        qr{Can't parse version '\x00\x00\x03'}
+    );
+    ok $res, q|we know how to deal with our $VERSION = 0.0.3; style versions defined in the module|;
+    like $res, $version_regex, $version_action;
+}
+
+
+note ".5 version"; {
+    my $mm = $new_mm->(
+        DISTNAME => 'Array::Suffix',
+        VERSION  => '.5',
+    );
+    my $res = $warn_ok->(
+        sub { eval { $mm->metafile_target } },
+        qr{Can't parse version '.5'}
+    );
+    ok $res, q|we know how to deal with our $VERSION = '.5'; style versions defined in the module|;
+    like $res, $version_regex, $version_action;
+}
+
+
+note "Non-camel case metadata"; {
+    my $mm = $new_mm->(
+        DISTNAME   => 'Attribute::Signature',
+        META_MERGE => {
+            resources => {
+                repository         => 'http://github.com/chorny/Attribute-Signature',
+                'Repository-clone' => 'git://github.com/chorny/Attribute-Signature.git',
+            },
+        },
+    );
+    my $res = eval { $mm->metafile_target };
+    ok $res, q|we know how to deal with non-camel-cased custom meta resource keys defined in Makefile.PL|;
+    like $res, qr/x_Repositoryclone:/, "they're camel-cased";
+}
+
+
+note "version object in provides"; {
+    my $mm = $new_mm->(
+        DISTNAME   => 'CPAN::Testers::ParseReport',
+        VERSION    => '2.34',
+        META_ADD => {
+            provides => {
+                "CPAN::Testers::ParseReport" => {
+                    version => version->declare("v1.2.3"),
+                    file    => "lib/CPAN/Testers/ParseReport.pm"
+                }
+            }
+        },
+    );
+    my $res = eval { $mm->metafile_target };
+    like $res, qr{version: \s* v1.2.3}x;
+}
index 9e57cae..4c8fa76 100644 (file)
@@ -3,12 +3,51 @@ BEGIN {
 }
 
 use strict;
-use Test::More tests => 7;
+use Test::More tests => 19;
 
 use Data::Dumper;
+use File::Temp;
+use Cwd;
+use Parse::CPAN::Meta;
 
 require ExtUtils::MM_Any;
 
+sub in_dir(&;$) {
+    my $code = shift;
+    my $dir = shift || File::Temp->newdir;
+
+    # chdir to the new directory
+    my $orig_dir = cwd();
+    chdir $dir or die "Can't chdir to $dir: $!";
+
+    # Run the code, but trap the error so we can chdir back
+    my $return;
+    my $ok = eval { $return = $code->(); 1; };
+    my $err = $@;
+
+    # chdir back
+    chdir $orig_dir or die "Can't chdir to $orig_dir: $!";
+
+    # rethrow if necessary
+    die $err unless $ok;
+
+    return $return;
+}
+
+sub mymeta_ok {
+    my($have, $want, $name) = @_;
+
+    local $Test::Builder::Level = $Test::Builder::Level + 1;
+
+    my $have_gen = delete $have->{generated_by};
+    my $want_gen = delete $want->{generated_by};
+
+    is_deeply $have, $want, $name;
+    like $have_gen, qr{CPAN::Meta}, "CPAN::Meta mentioned in the generated_by";
+
+    return;
+}
+
 my $new_mm = sub {
     return bless { ARGS => {@_}, @_ }, 'ExtUtils::MM_Any';
 };
@@ -22,12 +61,13 @@ my $new_mm = sub {
         },
     );
 
-    is_deeply [$mm->metafile_data], [
+    is_deeply {$mm->metafile_data}, {
         name            => 'Foo-Bar',
         version         => 1.23,
-        abstract        => undef,
+        abstract        => 'unknown',
         author          => [],
         license         => 'unknown',
+        dynamic_config  => 1,
         distribution_type       => 'module',
 
         configure_requires      => {
@@ -46,15 +86,16 @@ my $new_mm = sub {
             url         => 'http://module-build.sourceforge.net/META-spec-v1.4.html', 
             version     => 1.4
         },
-    ];
+    };
 
 
-    is_deeply [$mm->metafile_data({}, { no_index => { directory => [qw(foo)] } })], [
+    is_deeply {$mm->metafile_data({}, { no_index => { directory => [qw(foo)] } })}, {
         name            => 'Foo-Bar',
         version         => 1.23,
-        abstract        => undef,
+        abstract        => 'unknown',
         author          => [],
         license         => 'unknown',
+        dynamic_config  => 1,
         distribution_type       => 'module',
 
         configure_requires      => {
@@ -73,7 +114,7 @@ my $new_mm = sub {
             url         => 'http://module-build.sourceforge.net/META-spec-v1.4.html', 
             version     => 1.4
         },
-    ], 'rt.cpan.org 39348';
+    }, 'rt.cpan.org 39348';
 }
 
 
@@ -88,7 +129,7 @@ my $new_mm = sub {
         },
     );
 
-    is_deeply [$mm->metafile_data(
+    is_deeply {$mm->metafile_data(
         {
             configure_requires => {
                 Stuff   => 2.34
@@ -101,13 +142,14 @@ my $new_mm = sub {
             },
             wibble      => 23
         },
-    )],
-    [
+    )},
+    {
         name            => 'Foo-Bar',
         version         => 1.23,
-        abstract        => undef,
+        abstract        => 'unknown',
         author          => ['Some Guy'],
         license         => 'unknown',
+        dynamic_config  => 1,
         distribution_type       => 'script',
 
         configure_requires      => {
@@ -135,7 +177,7 @@ my $new_mm = sub {
 
         wibble  => 23,
         wobble  => 42,
-    ];
+    };
 }
 
 
@@ -150,12 +192,13 @@ my $new_mm = sub {
         MIN_PERL_VERSION => 5.006,
     );
 
-    is_deeply [$mm->metafile_data], [
+    is_deeply {$mm->metafile_data}, {
         name            => 'Foo-Bar',
         version         => 1.23,
-        abstract        => undef,
+        abstract        => 'unknown',
         author          => [],
         license         => 'unknown',
+        dynamic_config  => 1,
         distribution_type       => 'module',
 
         configure_requires      => {
@@ -178,7 +221,7 @@ my $new_mm = sub {
             url         => 'http://module-build.sourceforge.net/META-spec-v1.4.html', 
             version     => 1.4
         },
-    ];
+    };
 }
 
 
@@ -196,12 +239,13 @@ my $new_mm = sub {
         },
     );
 
-    is_deeply [$mm->metafile_data], [
+    is_deeply {$mm->metafile_data}, {
         name            => 'Foo-Bar',
         version         => 1.23,
-        abstract        => undef,
+        abstract        => 'unknown',
         author          => [],
         license         => 'unknown',
+        dynamic_config  => 1,
         distribution_type       => 'module',
 
         configure_requires      => {
@@ -225,7 +269,7 @@ my $new_mm = sub {
             url         => 'http://module-build.sourceforge.net/META-spec-v1.4.html', 
             version     => 1.4
         },
-    ];
+    };
 }
 
 # Test CONFIGURE_REQUIRES
@@ -241,12 +285,13 @@ my $new_mm = sub {
         },
     );
 
-    is_deeply [$mm->metafile_data], [
+    is_deeply {$mm->metafile_data}, {
         name            => 'Foo-Bar',
         version         => 1.23,
-        abstract        => undef,
+        abstract        => 'unknown',
         author          => [],
         license         => 'unknown',
+        dynamic_config  => 1,
         distribution_type       => 'module',
 
         configure_requires      => {
@@ -265,7 +310,7 @@ my $new_mm = sub {
             url         => 'http://module-build.sourceforge.net/META-spec-v1.4.html', 
             version     => 1.4
         },
-    ],'CONFIGURE_REQUIRES';
+    },'CONFIGURE_REQUIRES';
 }
 
 # Test BUILD_REQUIRES
@@ -281,12 +326,13 @@ my $new_mm = sub {
         },
     );
 
-    is_deeply [$mm->metafile_data], [
+    is_deeply {$mm->metafile_data}, {
         name            => 'Foo-Bar',
         version         => 1.23,
-        abstract        => undef,
+        abstract        => 'unknown',
         author          => [],
         license         => 'unknown',
+        dynamic_config  => 1,
         distribution_type       => 'module',
 
         configure_requires      => {
@@ -305,5 +351,149 @@ my $new_mm = sub {
             url         => 'http://module-build.sourceforge.net/META-spec-v1.4.html', 
             version     => 1.4
         },
-    ],'CONFIGURE_REQUIRES';
+    },'CONFIGURE_REQUIRES';
+}
+
+# Test _REQUIRES key priority over META_ADD
+
+{
+    my $mm = $new_mm->(
+        DISTNAME        => 'Foo-Bar',
+        VERSION         => 1.23,
+        BUILD_REQUIRES => {
+            "Fake::Module1" => 1.01,
+        },
+        META_ADD => (my $meta_add = { build_requires => {} }),
+        PM              => {
+            "Foo::Bar"          => 'lib/Foo/Bar.pm',
+        },
+    );
+
+    is_deeply {$mm->metafile_data($meta_add)}, {
+        name            => 'Foo-Bar',
+        version         => 1.23,
+        abstract        => 'unknown',
+        author          => [],
+        license         => 'unknown',
+        dynamic_config  => 1,
+        distribution_type       => 'module',
+
+        configure_requires      => {
+            'ExtUtils::MakeMaker'       => 0,
+        },
+        build_requires      => { },
+
+        no_index        => {
+            directory           => [qw(t inc)],
+        },
+
+        generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
+        'meta-spec'  => {
+            url         => 'http://module-build.sourceforge.net/META-spec-v1.4.html', 
+            version     => 1.4
+        },
+    },'META.yml data (META_ADD wins)';
+
+
+    # Yes, this is all hard coded.
+    require CPAN::Meta;
+    my $want_mymeta = {
+        name            => 'ExtUtils-MakeMaker',
+        version         => '6.57_07',
+        abstract        => 'Create a module Makefile',
+        author          => ['Michael G Schwern <schwern@pobox.com>'],
+        license         => 'perl',
+        dynamic_config  => 0,
+
+        requires        => {
+            "DirHandle"         => 0,
+            "File::Basename"    => 0,
+            "File::Spec"        => "0.8",
+            "Pod::Man"          => 0,
+            "perl"              => "5.006"
+        },
+
+        configure_requires      => {
+        },
+        build_requires      => {
+            'Fake::Module1'       => 1.01,
+        },
+
+        resources => {
+            license     =>      'http://dev.perl.org/licenses/',
+            homepage    =>      'http://makemaker.org',
+            bugtracker  =>      'http://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker',
+            repository  =>      'http://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker',
+            x_MailingList =>      'makemaker@perl.org',
+        },
+
+        no_index        => {
+            directory           => [qw(t inc)],
+            package             => ["DynaLoader", "in"],
+        },
+
+        generated_by => "ExtUtils::MakeMaker version 6.5707, CPAN::Meta::Converter version 2.110580",
+        'meta-spec'  => {
+            url         => 'http://module-build.sourceforge.net/META-spec-v1.4.html', 
+            version     => 1.4
+        },
+    };
+
+    mymeta_ok $mm->mymeta("t/META_for_testing.json"),
+              $want_mymeta,
+              'MYMETA JSON data (BUILD_REQUIRES wins)';
+
+    mymeta_ok $mm->mymeta("t/META_for_testing.yml"),
+              $want_mymeta,
+              'MYMETA YAML data (BUILD_REQUIRES wins)';
+}
+
+
+note "CPAN::Meta bug using the module version instead of the meta spec version"; {
+    my $mm = $new_mm->(
+        NAME      => 'GD::Barcode::Code93',
+        AUTHOR    => 'Chris DiMartino',
+        ABSTRACT  => 'Code 93 implementation of GD::Barcode family',
+        PREREQ_PM => {
+            'GD::Barcode' => 0,
+            'GD'          => 0
+        },
+        VERSION   => '1.4',
+    );
+
+    my $meta = $mm->mymeta("t/META_for_testing_tricky_version.yml");
+    is $meta->{'meta-spec'}{version}, 1.4;
+
+    in_dir {
+        $mm->write_mymeta($meta);
+        ok -e "MYMETA.yml";
+        ok -e "MYMETA.json";
+
+        my $meta_yml = Parse::CPAN::Meta->load_file("MYMETA.yml");
+        is $meta_yml->{'meta-spec'}{version}, 1.4, "MYMETA.yml correctly downgraded to 1.4";
+
+        my $meta_json = Parse::CPAN::Meta->load_file("MYMETA.json");
+        cmp_ok $meta_json->{'meta-spec'}{version}, ">=", 2, "MYMETA.json at 2 or better";
+    };
+
+}
+
+
+note "A bad license string"; {
+    my $mm = $new_mm->(
+        DISTNAME  => 'Foo::Bar',
+        VERSION   => '1.4',
+        LICENSE   => 'death and retribution',
+    );
+
+    in_dir {
+        my $meta = $mm->mymeta;
+        $mm->write_mymeta($meta);
+
+        my $meta_yml = Parse::CPAN::Meta->load_file("MYMETA.yml");
+        is $meta_yml->{license}, "unknown", "in yaml";
+
+        my $meta_json = Parse::CPAN::Meta->load_file("MYMETA.json");
+        is_deeply $meta_json->{license}, ["unknown"], "in json";
+    };
 }
index 6d892b9..fb19ae1 100644 (file)
@@ -8,7 +8,7 @@ BEGIN {
 }
 
 use strict;
-use Test::More tests => 35;
+use Test::More tests => 32;
 
 use TieOut;
 use MakeMaker::Test::Utils;
@@ -102,13 +102,11 @@ END
             MIN_PERL_VERSION => 'foobar',
         );
     };
-    ok( '' ne $warnings,    'MIN_PERL_VERSION=foobar triggers a warning' );
-    is( $warnings, <<'END', '  with expected message text' );
+    is( $@, <<'END', 'Invalid MIN_PERL_VERSION is fatal' );
 Warning: MIN_PERL_VERSION is not in a recognized format.
 Recommended is a quoted numerical value like '5.005' or '5.008001'.
 END
 
-    is( $@, '',             '  and without a hard failure' );
 }
 
 
@@ -158,7 +156,6 @@ END
     ok( -e $makefile, 'Makefile present' );
 }
 
-
 # ----- ppd output -----
 {
     my $ppd_file = 'Min-PerlVers.ppd';
@@ -180,24 +177,31 @@ END
     my $distdir  = 'Min-PerlVers-0.05';
     $distdir =~ s{\.}{_}g if $Is_VMS;
 
-    my $mymeta_yml = "MYMETA.yml";
-    my $mymeta = slurp($mymeta_yml);
-
-    ok( defined($mymeta),  '  MYMETA.yml present' );
-
-    like( $mymeta, qr{\nrequires:[^\S\n]*\n\s+perl:\s+5\.005\n\s+strict:\s+0\n},
-                         '  MYMETA.yml content good');
-
     my $meta_yml = "$distdir/META.yml";
+    my $meta_json = "$distdir/META.json";
     my @make_out    = run(qq{$make metafile});
     END { rmtree $distdir }
 
-    cmp_ok( $?, '==', 0, 'Make metafile exiting normally' ) || diag(@make_out);
-    my $meta = slurp($meta_yml);
-    ok( defined($meta),  '  META.yml present' );
-
-    like( $meta, qr{\nrequires:[^\S\n]*\n\s+perl:\s+5\.005\n\s+strict:\s+0\n},
-                         '  META.yml content good');
+    SKIP: {
+      skip "CPAN::Meta required", 4
+        unless eval { require CPAN::Meta };
+
+      for my $case (
+        ['META.yml', $meta_yml],
+        ['META.json', $meta_json],
+      ) {
+        my ($label, $meta_name) = @$case;
+        ok(
+          my $obj = eval {
+            CPAN::Meta->load_file($meta_name, {lazy_validation => 0})
+          },
+          "$label validates"
+        );
+        is( $obj->prereqs->{runtime}{requires}{perl}, '5.005',
+          "$label has runtime/requires perl 5.005"
+        );
+      }
+    }
 }
 
 __END__
index 2334eb0..9a4def2 100644 (file)
@@ -6,7 +6,15 @@
 use strict;
 use lib 't/lib';
 
-use Test::More 'no_plan';
+use Test::More;
+
+# In a BEGIN block so the END tests aren't registered.
+BEGIN {
+    plan skip_all => "miniperl test only necessary for the perl core"
+      if !$ENV{PERL_CORE};
+    
+    plan "no_plan";
+}
 
 BEGIN {
     ok !$INC{"ExtUtils/MakeMaker.pm"}, "MakeMaker is not yet loaded";
index b040872..4523441 100644 (file)
@@ -7,7 +7,7 @@ BEGIN {
 chdir 't';
 
 use MakeMaker::Test::Utils;
-use Test::More tests => 6;
+use Test::More tests => 11;
 use File::Spec;
 
 my $TB = Test::More->builder;
@@ -40,6 +40,13 @@ try_oneliner(q{$PATH = 'foo'; print $PATH},[], q{foo},   'dollar signs' );
 # switches?
 try_oneliner(q{print 'foo'}, ['-l'],           "foo\n",       'switches' );
 
+# some DOS-specific things
+try_oneliner(q{print " \" "}, [],  q{ " },  'single quote' );
+try_oneliner(q{print " < \" "}, [],  q{ < " },  'bracket, then quote' );
+try_oneliner(q{print " \" < "}, [],  q{ " < },  'quote, then bracket' );
+try_oneliner(q{print " < \"\" < \" < \" < "}, [],  q{ < "" < " < " < },  'quotes and brackets mixed' );
+try_oneliner(q{print " < \" | \" < | \" < \" < "}, [],  q{ < " | " < | " < " < },  'brackets, pipes and quotes' );
+
 # XXX gotta rethink the newline test.  The Makefile does newline
 # escaping, then the shell.
 
index 094fee7..07bbaf0 100644 (file)
@@ -8,7 +8,7 @@ BEGIN {
 }
 
 use strict;
-use Test::More tests => 13;
+use Test::More tests => 16;
 
 use TieOut;
 use MakeMaker::Test::Utils;
@@ -36,7 +36,7 @@ ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
         $warnings .= join '', @_;
     };
     # prerequisite warnings are disabled while building the perl core:
-    local $ENV{PERL_CORE} = undef;
+    local $ENV{PERL_CORE} = 0;
 
     WriteMakefile(
         NAME            => 'Big::Dummy',
@@ -67,6 +67,20 @@ ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
     is $warnings, 
     "Warning: prerequisite I::Do::Not::Exist 0 not found.\n";
 
+
+    $warnings = '';
+    WriteMakefile(
+        NAME            => 'Big::Dummy',
+        PREREQ_PM       => {
+            "I::Do::Not::Exist" => "",
+        }
+    );
+    my @warnings = split /\n/, $warnings;
+    is @warnings, 2;
+    like $warnings[0], qr{^Unparsable version '' for prerequisite I::Do::Not::Exist\b};
+    is $warnings[1], "Warning: prerequisite I::Do::Not::Exist 0 not found.";
+
+
     $warnings = '';
     WriteMakefile(
         NAME            => 'Big::Dummy',
index b11d05e..4fa0720 100644 (file)
-#!/usr/bin/perl -w\r
-\r
-# This is a test checking various aspects of the optional argument\r
-# MIN_PERL_VERSION to WriteMakefile.\r
-\r
-BEGIN {\r
-    unshift @INC, 't/lib';\r
-}\r
-\r
-use strict;\r
-use Test::More tests => 18;\r
-\r
-use TieOut;\r
-use MakeMaker::Test::Utils;\r
-use MakeMaker::Test::Setup::SAS;\r
-use File::Path;\r
-\r
-use ExtUtils::MakeMaker;\r
-\r
-# avoid environment variables interfering with our make runs\r
-delete @ENV{qw(LIB MAKEFLAGS)};\r
-\r
-my $perl     = which_perl();\r
-my $make     = make_run();\r
-my $makefile = makefile_name();\r
-\r
-chdir 't';\r
-\r
-perl_lib();\r
-\r
-ok( setup_recurs(), 'setup' );\r
-END {\r
-    ok( chdir(File::Spec->updir), 'leaving dir' );\r
-    ok( teardown_recurs(), 'teardown' );\r
-}\r
-\r
-ok( chdir $MakeMaker::Test::Setup::SAS::dirname, "entering dir $MakeMaker::Test::Setup::SAS::dirname" ) ||\r
-    diag("chdir failed: $!");\r
-\r
-{\r
-    # ----- argument verification -----\r
-\r
-    my $stdout = tie *STDOUT, 'TieOut';\r
-    ok( $stdout, 'capturing stdout' );\r
-    my $warnings = '';\r
-    local $SIG{__WARN__} = sub {\r
-        $warnings .= join '', @_;\r
-    };\r
-\r
-    eval {\r
-        WriteMakefile(\r
-            NAME             => 'Multiple::Authors',\r
-            AUTHOR           => ['John Doe <jd@example.com>', 'Jane Doe <jd@example.com>'],\r
-        );\r
-    };\r
-    is( $warnings, '', 'arrayref in AUTHOR does not trigger a warning' );\r
-    is( $@, '',        '  nor a hard failure' );\r
-\r
-}\r
-\r
-\r
-{\r
-    # ----- argument verification -----\r
-\r
-    my $stdout = tie *STDOUT, 'TieOut';\r
-    ok( $stdout, 'capturing stdout' );\r
-    my $warnings = '';\r
-    local $SIG{__WARN__} = sub {\r
-        $warnings .= join '', @_;\r
-    };\r
-\r
-    eval {\r
-        WriteMakefile(\r
-            NAME             => 'Multiple::Authors',\r
-            CONFIGURE => sub { \r
-               return {AUTHOR => 'John Doe <jd@example.com>',};\r
-            },\r
-        );\r
-    };\r
-    is( $warnings, '', 'scalar in AUTHOR inside CONFIGURE does not trigger a warning' );\r
-    is( $@, '',        '  nor a hard failure' );\r
-\r
-}\r
-\r
-\r
-# ----- generated files verification -----\r
-{\r
-    unlink $makefile;\r
-    my @mpl_out = run(qq{$perl Makefile.PL});\r
-    END { unlink $makefile, makefile_backup() }\r
-\r
-    cmp_ok( $?, '==', 0, 'Makefile.PL exiting normally' ) || diag(@mpl_out);\r
-    ok( -e $makefile, 'Makefile present' );\r
-}\r
-\r
-\r
-# ----- ppd output -----\r
-{\r
-    my $ppd_file = 'Multiple-Authors.ppd';\r
-    my @make_out = run(qq{$make ppd});\r
-    END { unlink $ppd_file }\r
-\r
-    cmp_ok( $?, '==', 0,    'Make ppd exiting normally' ) || diag(@make_out);\r
-\r
-    my $ppd_html = slurp($ppd_file);\r
-    ok( defined($ppd_html), '  .ppd file present' );\r
-\r
-    like( $ppd_html, qr{John Doe &lt;jd\@example.com&gt;, Jane Doe &lt;jd\@example.com&gt;},\r
-                            '  .ppd file content good' );\r
-}\r
-\r
-\r
-# ----- META.yml output -----\r
-{\r
-    my $distdir  = 'Multiple-Authors-0.05';\r
-    $distdir =~ s{\.}{_}g if $Is_VMS;\r
-\r
-    my $meta_yml = "$distdir/META.yml";\r
-    my @make_out    = run(qq{$make metafile});\r
-    END { rmtree $distdir }\r
-\r
-    cmp_ok( $?, '==', 0, 'Make metafile exiting normally' ) || diag(@make_out);\r
-    my $meta = slurp($meta_yml);\r
-    ok( defined($meta),  '  META.yml present' );\r
-\r
-    like( $meta, qr{\nauthor:\n\s+- John Doe <jd\@example.com>\n\s+- Jane Doe <jd\@example.com>\n},\r
-                         '  META.yml content good');\r
-}\r
-\r
-__END__\r
+#!/usr/bin/perl -w
+
+# This is a test checking various aspects of the optional argument
+# MIN_PERL_VERSION to WriteMakefile.
+
+BEGIN {
+    unshift @INC, 't/lib';
+}
+
+use strict;
+use Test::More tests => 20;
+
+use TieOut;
+use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::SAS;
+use File::Path;
+
+use ExtUtils::MakeMaker;
+
+# avoid environment variables interfering with our make runs
+delete @ENV{qw(LIB MAKEFLAGS)};
+
+my $perl     = which_perl();
+my $make     = make_run();
+my $makefile = makefile_name();
+
+chdir 't';
+
+perl_lib();
+
+ok( setup_recurs(), 'setup' );
+END {
+    ok( chdir(File::Spec->updir), 'leaving dir' );
+    ok( teardown_recurs(), 'teardown' );
+}
+
+ok( chdir $MakeMaker::Test::Setup::SAS::dirname, "entering dir $MakeMaker::Test::Setup::SAS::dirname" ) ||
+    diag("chdir failed: $!");
+
+{
+    # ----- argument verification -----
+
+    my $stdout = tie *STDOUT, 'TieOut';
+    ok( $stdout, 'capturing stdout' );
+    my $warnings = '';
+    local $SIG{__WARN__} = sub {
+        $warnings .= join '', @_;
+    };
+
+    eval {
+        WriteMakefile(
+            NAME             => 'Multiple::Authors',
+            AUTHOR           => ['John Doe <jd@example.com>', 'Jane Doe <jd@example.com>'],
+        );
+    };
+    is( $warnings, '', 'arrayref in AUTHOR does not trigger a warning' );
+    is( $@, '',        '  nor a hard failure' );
+
+}
+
+
+{
+    # ----- argument verification -----
+
+    my $stdout = tie *STDOUT, 'TieOut';
+    ok( $stdout, 'capturing stdout' );
+    my $warnings = '';
+    local $SIG{__WARN__} = sub {
+        $warnings .= join '', @_;
+    };
+
+    eval {
+        WriteMakefile(
+            NAME             => 'Multiple::Authors',
+            CONFIGURE => sub { 
+               return {AUTHOR => 'John Doe <jd@example.com>',};
+            },
+        );
+    };
+    is( $warnings, '', 'scalar in AUTHOR inside CONFIGURE does not trigger a warning' );
+    is( $@, '',        '  nor a hard failure' );
+
+}
+
+
+# ----- generated files verification -----
+{
+    unlink $makefile;
+    my @mpl_out = run(qq{$perl Makefile.PL});
+    END { unlink $makefile, makefile_backup() }
+
+    cmp_ok( $?, '==', 0, 'Makefile.PL exiting normally' ) || diag(@mpl_out);
+    ok( -e $makefile, 'Makefile present' );
+}
+
+
+# ----- ppd output -----
+{
+    my $ppd_file = 'Multiple-Authors.ppd';
+    my @make_out = run(qq{$make ppd});
+    END { unlink $ppd_file }
+
+    cmp_ok( $?, '==', 0,    'Make ppd exiting normally' ) || diag(@make_out);
+
+    my $ppd_html = slurp($ppd_file);
+    ok( defined($ppd_html), '  .ppd file present' );
+
+    like( $ppd_html, qr{John Doe &lt;jd\@example.com&gt;, Jane Doe &lt;jd\@example.com&gt;},
+                            '  .ppd file content good' );
+}
+
+
+# ----- META.yml output -----
+{
+    my $distdir  = 'Multiple-Authors-0.05';
+    $distdir =~ s{\.}{_}g if $Is_VMS;
+
+    my $meta_yml = "$distdir/META.yml";
+    my $meta_json = "$distdir/META.json";
+    my @make_out    = run(qq{$make metafile});
+    END { rmtree $distdir }
+
+    cmp_ok( $?, '==', 0, 'Make metafile exiting normally' ) || diag(@make_out);
+
+    SKIP: {
+      skip "CPAN::Meta required", 4
+        unless eval { require CPAN::Meta };
+
+      for my $case (
+        ['META.yml', $meta_yml],
+        ['META.json', $meta_json],
+      ) {
+        my ($label, $meta_name) = @$case;
+        ok(
+          my $obj = eval {
+            CPAN::Meta->load_file($meta_name, {lazy_validation => 0})
+          },
+          "$label validates"
+        );
+        is_deeply( [ $obj->authors ],
+          [
+            q{John Doe <jd@example.com>},
+            q{Jane Doe <jd@example.com>},
+          ],
+          "$label content good"
+        );
+      }
+    }
+}
+
+__END__
index 421a311..daa8255 100644 (file)
@@ -225,7 +225,7 @@ VERIFY
     };
     is( $warnings, '' );
     is_deeply( $mm->{AUTHOR},  ["test"] );
-
+    
 
     # AUTHOR / array
     $warnings = '';
@@ -238,5 +238,5 @@ VERIFY
     };
     is( $warnings, '' );
     is_deeply( $mm->{AUTHOR},  ["test1","test2"] );
-
+    
 }
index 8ed35bc..6ee5362 100644 (file)
@@ -150,6 +150,10 @@ L<CPANPLUS> has been upgraded from version 0.9105 to version 0.9106
 
 =item *
 
+L<ExtUtils::MakeMaker> has been upgraded from version 6.57_05 to version 6.58
+
+=item *
+
 L<IPC::Cmd> has been upgraded from version 0.70 to version 0.72
 
 Capturing of command output (both C<STDOUT> and C<STDERR>) is now supported