The documentation for CPAN::Meta::Converter starts as follows:
NAME
CPAN::Meta::Converter - Convert CPAN distribution metadata structures
VERSION
version 2.150010
SYNOPSIS
my $struct = decode_json_file('META.json');
my $cmc = CPAN::Meta::Converter->new( $struct );
my $new_struct = $cmc->convert( version => "2" );
Note that the SYNOPSIS instructs one to use a function called decode_json_file. I tried this in the following:
$ cat convert-metadata.pl
#!/usr/bin/env perl
use 5.14.0;
use warnings;
use Carp;
use CPAN::Meta::Converter;
my $jsonfile = './META.json';
croak "Unable to locate $jsonfile" unless -f $jsonfile;
my $struct = decode_json_file($jsonfile);
my $cmc = CPAN::Meta::Converter->new($struct);
my $new_struct = $cmc->convert( version => "2" );
$ perl convert-metadata.pl
Undefined subroutine &main::decode_json_file called at convert-metadata.pl line 10.
The program fails because there is no such function as decode_json_file. If I add use JSON::PP;, I can use the decode_json() function -- but that is documented as taking a string which is UTF-8 encoded JSON text -- not a .json file.
The non-existent decode_json_file() function is also found in the SYNOPSIS for CPAN::Meta::Validator.
The documentation for CPAN::Meta::Converter starts as follows:
Note that the SYNOPSIS instructs one to use a function called
decode_json_file
. I tried this in the following:The program fails because there is no such function as
decode_json_file
. If I adduse JSON::PP;
, I can use thedecode_json()
function -- but that is documented as taking a string which is UTF-8 encoded JSON text -- not a.json
file.The non-existent
decode_json_file()
function is also found in the SYNOPSIS for CPAN::Meta::Validator.Please revise.
Thank you very much. Jim Keenan