Created
November 21, 2012 02:27
-
-
Save issm/4122676 to your computer and use it in GitHub Desktop.
pm-changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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