in reply to Module::Build::XSUtil build problem

Which version of Module::Build and CPAN::Meta do you have? CPAN?

I suggest upgrading all three

I have no problem with cpanm and

CPAN::Meta - 2.132140 Module::Build - 0.4007

Replies are listed 'Best First'.
Re^2: Module::Build::XSUtil build problem
by jimhallsun (Sexton) on Apr 09, 2014 at 12:19 UTC

    Yes - Something is up with CPAN::Meta on this box. On my solaris box I installed this module (baseline is perl 5.12 but I needed to download CPAN::Meta to install this module). The Solaris CPAN::Meta which works is at version 2.133380. On the Oracle Enterprise Linux box my perl is 5.10 and my CPAN::Meta is the latest version 2.140640.

    There are some big diffs between the two version (perldoc annotation on the newer linux box being an obvious one). I will see if there is any difference in the details of the module.

      I hacked CPAN::Meta a little here:

      sub load_file { my ($class, $file, $options) = @_; print "My file is: $file\n"; #jhall $options->{lazy_validation} = 1 unless exists $options->{lazy_valida +tion}; croak "load_file() requires a valid, readable filename for $file" unless -r $file;

      On the good box it does:

      jhall@jimwin8:~/.cpan/build/Module-Build-XSUtil-0.06-d9Wlfd$ perlgcc2 Build.PL
      My file is: META.json
      Created MYMETA.yml and MYMETA.json
      Creating new 'Build' script for 'Module-Build-XSUtil' version '0.06'
      My file is: META.yml
      My file is: MYMETA.json
      My file is: META.json
      Merging cpanfile prereqs to MYMETA.yml
      Merging cpanfile prereqs to MYMETA.json
      

      On the bad box:

      oracle@localhost Module-Build-XSUtil-0.06-si9LjM$ perl Build.PL
      Deleting _build
      Creating custom builder _build/lib/MyBuilder.pm in _build/lib
      Checking whether your kit is complete...
      Looks good
      
      Checking prerequisites...
      Looks good
      
      Deleting Build
      Removed previous script 'Build'
      
      Creating new 'Build' script for 'Module-Build-XSUtil' version '0.06'
      My file is: MYMETA.json
      load_file() requires a valid, readable filename for MYMETA.json at Build.PL line 56
      

      I guess I need to sort out where is MYMETA.* created.... it must be buried in the new/create method... just difficult to sort out.

        I think the problem is in Parse::CPAN::Meta, seems to be a lot of changes here:

        --- Meta.pm 2014-03-04 15:22:05.000000000 -0500 +++ /u01/oracle/Meta.pm 2014-04-10 11:24:46.069085636 -0400 @@ -2,7 +2,7 @@ use 5.008001; use strict; package Parse::CPAN::Meta; # ABSTRACT: Parse META.yml and META.json CPAN metadata files -our $VERSION = '1.4414'; # VERSION +our $VERSION = '1.4413'; # VERSION use Exporter; use Carp 'croak'; @@ -13,30 +13,15 @@ our @EXPORT_OK = qw/Load LoadFile/; sub load_file { my ($class, $filename) = @_; - my $meta = _slurp($filename); - if ($filename =~ /\.ya?ml$/) { - return $class->load_yaml_string($meta); - } - elsif ($filename =~ /\.json$/) { - return $class->load_json_string($meta); - } - else { - $class->load_string($meta); # try to detect yaml/json + return $class->load_yaml_string(_slurp($filename)); } -} -sub load_string { - my ($class, $string) = @_; - if ( $string =~ /^---/ ) { # looks like YAML - return $class->load_yaml_string($string); - } - elsif ( $string =~ /^\s*\{/ ) { # looks like JSON - return $class->load_json_string($string); - } - else { # maybe doc-marker-free YAML - return $class->load_yaml_string($string); + if ($filename =~ /\.json$/) { + return $class->load_json_string(_slurp($filename)); } + + croak("file type cannot be determined by filename"); } sub load_yaml_string { @@ -136,7 +121,7 @@ Parse::CPAN::Meta - Parse META.yml and M =head1 VERSION -version 1.4414 +version 1.4413 =head1 SYNOPSIS @@ -216,13 +201,6 @@ This method deserializes the given strin If the source was UTF-8 encoded, the string must be decoded before ca +lling C<load_json_string>. -=head2 load_string - - my $metadata_structure = Parse::CPAN::Meta->load_string($some_strin +g); - -If you don't know whether a string contains YAML or JSON data, this m +ethod -will use some heuristics and guess. If it can't tell, it assumes YAM +L. - =head2 yaml_backend my $backend = Parse::CPAN::Meta->yaml_backend;

        Will see if I can trouble shoot further. Any suggestions appreciated.