$ perl Makefile.PL
$ make test
:
All tests successful.
:
Result: PASS
$ make distcheck
####
$ cat sandbox/used-by.pl
#!/usr/bin/perl
use 5.16.2;
use warnings;
use LWP;
use LWP::UserAgent;
use HTML::TreeBuilder;
use CPAN;
use Capture::Tiny qw( :all );
use Test::More;
my $tm = "Data-Peek"; # The module I want to check
my %tm = map { $_ => 1 } qw( );
$| = 1;
$ENV{AUTOMATED_TESTING} = 1;
# Skip all dists that
# - are FAIL but not due to Data::Peek
# - that require interaction (not dealt with in distroprefs)
# - are not proper dists (cannot use CPAN's ->test)
# - require external connections or special devices
my %skip = map { $_ => 1 } qw(
GSM-Gnokii
);
my $url = "http://cpants.cpanauthors.org/dist/$tm/used_by";
my $ua = LWP::UserAgent->new (agent => "Opera/12.15");
my $rsp = $ua->request (HTTP::Request->new (GET => $url));
$rsp->is_success or die "get failed: ", $rsp->status_line, "\n";
my $tree = HTML::TreeBuilder->new;
$tree->parse_content ($rsp->content);
foreach my $a ($tree->look_down (_tag => "a", href => qr{/dist/})) {
(my $h = $a->attr ("href")) =~ s{.*dist/}{};
exists $skip{$h} || $h =~ m{^( $tm (?: $ | / ) | Task- )\b}x and next;
(my $m = $h) =~ s/-/::/g;
$tm{$m} = 1;
}
my %rslt;
foreach my $m (sort keys %tm) {
my $mod = CPAN::Shell->expand ("Module", "/$m/") or next;
# diag "$m ... ";
$rslt{$m} = [ [], capture { $mod->test } ];
$rslt{$m}[0] = [ $?, $!, $@ ];
is ($?, 0, $m);
}
done_testing;
####
$ prove -vwb sandbox/used-by.pl
sandbox/used-by.pl ..
Reading '/home/merijn/.cpan/Metadata'
Database was generated on Mon, 03 Mar 2014 14:17:02 GMT
CPAN: YAML loaded ok (v0.90)
Reading 3 yaml files from /home/merijn/.cpan/build/
..........................DONE
Restored the state of 1 (in 0.0431 secs)
ok 1 - App::tkiv
ok 2 - Geo::KML
ok 3 - Spreadsheet::Read
1..3
ok
All tests successful.
Files=1, Tests=3, 13 wallclock secs ( 0.02 usr 0.00 sys + 10.29 cusr 0.60 csys = 10.91 CPU)
Result: PASS
$