# data by "Module", which is really a dist.
my $file_to_M = files_to_modules( values %module_to_file );
+sub slurp_utf8($) {
+ open my $fh, "<:utf8", "$_[0]"
+ or die "can't open $_[0] for reading: $!";
+ return do { local $/; <$fh> };
+}
+
+sub parse_cpan_meta($) {
+ return Parse::CPAN::Meta->${
+ $_[0] =~ /\A\x7b/ ? \"load_json_string" : \"load_yaml_string"
+ }($_[0]);
+}
+
my %module_to_upstream;
my %module_to_dist;
my %dist_to_meta_YAML;
my $meta_YAML_url = 'http://ftp.funet.fi/pub/CPAN/' . $meta_YAML_path;
if ( -e "$cpan/$meta_YAML_path" ) {
- $dist_to_meta_YAML{$dist} = Parse::CPAN::Meta::LoadFile( $cpan . "/" . $meta_YAML_path );
+ $dist_to_meta_YAML{$dist} = parse_cpan_meta(slurp_utf8( $cpan . "/" . $meta_YAML_path ));
} elsif ( my $content = fetch_url($meta_YAML_url) ) {
unless ($content) {
warn "Failed to fetch $meta_YAML_url\n";
next;
}
- eval { $dist_to_meta_YAML{$dist} = Parse::CPAN::Meta::Load($content); };
+ eval { $dist_to_meta_YAML{$dist} = parse_cpan_meta($content); };
if ( my $err = $@ ) {
warn "$meta_YAML_path: ".$err;
next;
my $dist = $module_to_dist{$module};
$bug_tracker = $dist_to_meta_YAML{$dist}->{resources}{bugtracker}
if $dist;
+ $bug_tracker = $bug_tracker->{web} if ref($bug_tracker) eq "HASH";
$bug_tracker = defined $bug_tracker ? "'$bug_tracker'" : 'undef';
next if $bug_tracker eq "'http://rt.perl.org/perlbug/'";
unless ( $pod =~ /and $perl_vstring releases of perl/ ) {
warn "Adding $perl_vstring to the list of perl versions covered by Module::CoreList\n";
- $pod =~ s/(currently covers (?:.*?))\s*and (.*?) releases of perl/$1, $2 and $perl_vstring releases of perl/ism;
+ $pod =~ s/(currently\s+covers\s+(?:.*?))\s*and\s+(.*?)\s+releases\s+of\s+perl/$1, $2 and $perl_vstring releases of perl/ism;
}
write_corelist($pod,$pod_file);