| 1 |
#!perl |
| 2 |
use warnings; |
| 3 |
use strict; |
| 4 |
use File::Find; |
| 5 |
use Test::More; |
| 6 |
BEGIN { |
| 7 |
eval 'use Capture::Tiny ":all"; 1'; |
| 8 |
if ($@) { |
| 9 |
plan skip_all => "Capture::Tiny needed for testing"; |
| 10 |
exit 0; |
| 11 |
}; |
| 12 |
}; |
| 13 |
|
| 14 |
plan 'no_plan'; |
| 15 |
|
| 16 |
require './Makefile.PL'; |
| 17 |
# Loaded from Makefile.PL |
| 18 |
our %module = get_module_info(); |
| 19 |
|
| 20 |
my $last_version = undef; |
| 21 |
|
| 22 |
sub check { |
| 23 |
#return if (! m{(\.pm|\.pl) \z}xmsi); |
| 24 |
|
| 25 |
my ($stdout, $stderr, $exit) = capture(sub { |
| 26 |
system( $^X, '-Mblib', '-c', $_ ); |
| 27 |
}); |
| 28 |
|
| 29 |
s!\s*\z!! |
| 30 |
for ($stdout, $stderr); |
| 31 |
|
| 32 |
if( $exit ) { |
| 33 |
diag $stderr; |
| 34 |
diag "Exit code: ", $exit; |
| 35 |
fail($_); |
| 36 |
} elsif( $stderr ne "$_ syntax OK") { |
| 37 |
diag $stderr; |
| 38 |
fail($_); |
| 39 |
} else { |
| 40 |
pass($_); |
| 41 |
}; |
| 42 |
} |
| 43 |
|
| 44 |
my @files; |
| 45 |
find({wanted => \&wanted, no_chdir => 1}, |
| 46 |
grep { -d $_ } |
| 47 |
'blib/lib', 'examples', 'lib' |
| 48 |
); |
| 49 |
|
| 50 |
if( my $exe = $module{EXE_FILES}) { |
| 51 |
push @files, @$exe; |
| 52 |
}; |
| 53 |
|
| 54 |
for (@files) { |
| 55 |
check($_) |
| 56 |
} |
| 57 |
|
| 58 |
sub wanted { |
| 59 |
push @files, $File::Find::name if /\.p(l|m|od)$/; |
| 60 |
} |