| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
use Test::More 0.88; |
| 4 |
# This is a relatively nice way to avoid Test::NoWarnings breaking our |
| 5 |
# expectations by adding extra tests, without using no_plan. It also helps |
| 6 |
# avoid any other test module that feels introducing random tests, or even |
| 7 |
# test plans, is a nice idea. |
| 8 |
our $success = 0; |
| 9 |
END { $success && done_testing; } |
| 10 |
|
| 11 |
my $v = "\n"; |
| 12 |
|
| 13 |
eval { # no excuses! |
| 14 |
# report our Perl details |
| 15 |
my $want = '5.008'; |
| 16 |
my $pv = ($^V || $]); |
| 17 |
$v .= "perl: $pv (wanted $want) on $^O from $^X\n\n"; |
| 18 |
}; |
| 19 |
defined($@) and diag("$@"); |
| 20 |
|
| 21 |
# Now, our module version dependencies: |
| 22 |
sub pmver { |
| 23 |
my ($module, $wanted) = @_; |
| 24 |
$wanted = " (want $wanted)"; |
| 25 |
my $pmver; |
| 26 |
eval "require $module;"; |
| 27 |
if ($@) { |
| 28 |
if ($@ =~ m/Can't locate .* in \@INC/) { |
| 29 |
$pmver = 'module not found.'; |
| 30 |
} else { |
| 31 |
diag("${module}: $@"); |
| 32 |
$pmver = 'died during require.'; |
| 33 |
} |
| 34 |
} else { |
| 35 |
my $version; |
| 36 |
eval { $version = $module->VERSION; }; |
| 37 |
if ($@) { |
| 38 |
diag("${module}: $@"); |
| 39 |
$pmver = 'died during VERSION check.'; |
| 40 |
} elsif (defined $version) { |
| 41 |
$pmver = "$version"; |
| 42 |
} else { |
| 43 |
$pmver = '<undef>'; |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
# So, we should be good, right? |
| 48 |
return sprintf('%-45s => %-10s%-15s%s', $module, $pmver, $wanted, "\n"); |
| 49 |
} |
| 50 |
|
| 51 |
eval { $v .= pmver('Exporter','any version') }; |
| 52 |
eval { $v .= pmver('File::Copy','any version') }; |
| 53 |
eval { $v .= pmver('File::ShareDir::PathClass','any version') }; |
| 54 |
eval { $v .= pmver('File::Temp','any version') }; |
| 55 |
eval { $v .= pmver('Module::Build','0.3601') }; |
| 56 |
eval { $v .= pmver('Path::Class','any version') }; |
| 57 |
eval { $v .= pmver('Readonly','any version') }; |
| 58 |
eval { $v .= pmver('Test::More','0.88') }; |
| 59 |
eval { $v .= pmver('base','any version') }; |
| 60 |
eval { $v .= pmver('strict','any version') }; |
| 61 |
eval { $v .= pmver('warnings','any version') }; |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
# All done. |
| 66 |
$v .= <<'EOT'; |
| 67 |
|
| 68 |
Thanks for using my code. I hope it works for you. |
| 69 |
If not, please try and include this output in the bug report. |
| 70 |
That will help me reproduce the issue and solve you problem. |
| 71 |
|
| 72 |
EOT |
| 73 |
|
| 74 |
diag($v); |
| 75 |
ok(1, "we really didn't test anything, just reporting data"); |
| 76 |
$success = 1; |
| 77 |
|
| 78 |
# Work around another nasty module on CPAN. :/ |
| 79 |
no warnings 'once'; |
| 80 |
$Template::Test::NO_FLUSH = 1; |
| 81 |
exit 0; |