in reply to Post query to Metacpan API
#!/usr/bin/perl # Get the latest version numbers of your favorite modules # (If they exist and have a normal version number...) # Usage: $0 Module::Name Other::Module Etc use strict; use warnings; use HTTP::Tiny; use JSON::PP 'decode_json'; use MetaCPAN::Client; my @ARGS = @ARGV ? @ARGV : ('MetaCPAN::Client','MCE','Plack'); my $http = HTTP::Tiny->new; for (@ARGS) { print "$_\t", decode_json($http->get( "http://fastapi.metacpan.org/v1/module/$_" )->{content})->{version},"\n" } my $cpan = MetaCPAN::Client->new; for (@ARGS){ printf "%s: %s\n", $_, $cpan->module($_)->version; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Post query to Metacpan API
by stevieb (Canon) on Sep 20, 2018 at 21:50 UTC |