Skip to content

Instantly share code, notes, and snippets.

@issm
Created November 21, 2012 02:27
Show Gist options
  • Save issm/4122676 to your computer and use it in GitHub Desktop.
Save issm/4122676 to your computer and use it in GitHub Desktop.
pm-changes
#!/usr/bin/env perl
use strict;
use warnings;
use MetaCPAN::API;
use Pod::Usage;
use LWP::UserAgent;
my ($module) = @ARGV;
pod2usage() unless $module;
my $agent = 'pm-changes/0.01';
(my $modname = $module) =~ s/::/-/g;
my $mc = MetaCPAN::API->new(
ua_args => [ agent => $agent ],
);
my $dist= $mc->release( distribution => $modname );
my $changes;
my $ua = LWP::UserAgent->new( agent => $agent );
my @resources = qw/Changes CHANGES ChangeLog CHANGELOG/;
for my $resource ( @resources ) {
my $res = $ua->get( $mc->base_url . "/source/$dist->{author}/$dist->{name}/$resource" );
next unless $res->code == 200;
$changes = $res->content;
}
print $changes || "could not find\n";
__END__
=head1 NAME pm-changes - view Changes of module
=head1 SYNOPSIS
pm-changes <module>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment