Dist-Zilla-Plugin-CheckVersionIncrement
view release on metacpan or search on metacpan
lib/Dist/Zilla/Plugin/CheckVersionIncrement.pm view on Meta::CPAN
$pkg =~ s/-/::/g;
### $pkg
my $pkg_version = version->parse($self->zilla->version);
my $indexed_version;
my $ua = LWP::UserAgent->new(keep_alive => 1);
$ua->env_proxy;
my $res = $ua->get("http://cpanidx.org/cpanidx/json/mod/$pkg");
if ($res->is_success) {
my $yaml_octets = encode_utf8($res->decoded_content);
my $payload = JSON::PP->new->decode($yaml_octets);
if (@$payload) {
$indexed_version = version->parse($payload->[0]{mod_vers});
}
}
if ($indexed_version) {
return if $indexed_version < $pkg_version;
my $indexed_description;
# Check if we can get to CPAN index, skip if not
my $ua = LWP::UserAgent->new(keep_alive => 1);
$ua->env_proxy;
my $res = $ua->get("http://cpanidx.org/cpanidx/json/mod/Dist-Zilla-Plugin-CheckVersionIncrement");
if (!$res->is_success) {
plan skip_all => 'Cannot access CPAN index';
}
# Check that CPAN index returns something that contains a version
# number, skip if not
my $yaml_octets = encode_utf8($res->decoded_content);
my $payload = JSON::PP->new->decode($yaml_octets);
if (!(@$payload && $payload->[0]{mod_vers})) {
plan skip_all => 'CPAN index did not return a version number';
}
# This needs to be the name of an actual module on CPAN. May as well
# be this one.
my $module_text = <<'MODULE';
package Dist::Zilla::Plugin::CheckVersionIncrement;
( run in 0.394 second using v1.01-cache-2.11-cpan-26ccb49234f )