Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions lib/App/Cpan.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1249,10 +1249,7 @@ sub _show_Changes
next unless eval { $module->inst_file };
#next if $module->uptodate;

( my $id = $module->id() ) =~ s/::/\-/;

my $url = "http://search.cpan.org/~" . lc( $module->userid ) . "/" .
$id . "-" . $module->cpan_version() . "/";
my $url = "https://fastapi.metacpan.org/v1/module/" . $module->id();

#print "URL: $url\n";
_get_changes_file($url);
Expand All @@ -1263,21 +1260,21 @@ sub _show_Changes

sub _get_changes_file
{
croak "Reading Changes files requires LWP::Simple and URI\n"
unless _safe_load_module("LWP::Simple") && _safe_load_module("URI");
croak "Reading Changes files requires LWP::Simple, LWP::Protocol::https, JSON::PP\n"
unless _safe_load_module("LWP::Simple") && _safe_load_module("LWP::Protocol::https")
&& _safe_load_module("JSON::PP");

my $url = shift;

my $content = LWP::Simple::get( $url );
$logger->info( "Got $url ..." ) if defined $content;
#print $content;

my( $change_link ) = $content =~ m|<a href="(.*?)">Changes</a>|gi;

my $changes_url = URI->new_abs( $change_link, $url );
my $distribution = JSON::PP::decode_json( $content )->{distribution};
my $changes_url = "https://fastapi.metacpan.org/v1/changes/$distribution";
$logger->debug( "Change link is: $changes_url" );

my $changes = LWP::Simple::get( $changes_url );
my $changes = JSON::PP::decode_json( LWP::Simple::get( $changes_url ) )->{content};

print $changes;

Expand Down