Badge-Simple

 view release on metacpan or  search on metacpan

misc/scrape_cpantesters.pl  view on Meta::CPAN

#!/usr/bin/env perl
use warnings;
use 5.026;
use FindBin ();
use Path::Class qw/dir/;
use URI ();
use HTTP::Tiny ();
use Text::CleanFragment qw/clean_fragment/;
use Regexp::Common qw/balanced delimited/;
use JSON::MaybeXS ();
use XML::LibXML ();
use Data::Dump qw/dd/;

# Badge-Simple 0.01 had a ton of CPAN Testers failures
# This gets the reports and tries to figure out what's up

my $VERBOSE = 0;

misc/scrape_cpantesters.pl  view on Meta::CPAN

	die "fail mismatch?" unless $report->{result}{grade} eq 'fail';
	my @out_keys = keys $report->{result}{output}->%*;
	die "unexpected keys: @out_keys" unless @out_keys==1
		&& $out_keys[0] eq 'uncategorized';
	analyze( $report->{result}{output}{uncategorized} );
}

sub get {
	my ($url,$forcecache) = @_;
	state $http = HTTP::Tiny->new();
	my $file = $GET_CACHE->file(clean_fragment("$url"));
	$VERBOSE and print "$url: ";
	if ($forcecache && -e $file) {
		# assume file name is unique and won't be modified on server
		$VERBOSE and say "Cached"; return $file;
	} # else
	my $resp = $http->mirror($url, "$file");
	my $status = "$resp->{status} $resp->{reason}";
	if ($resp->{success}) { $VERBOSE and say $status }
	else { die $status }
	return $file;



( run in 0.684 second using v1.01-cache-2.11-cpan-364913b4093 )