| 1 | use strict; |
| 2 | use warnings; |
| 3 | use Config; |
| 4 | use Test::More tests => 1; |
| 5 | |
| 6 | # This .t file is generated. |
| 7 | # make changes instead to dist.ini |
| 8 | |
| 9 | my %modules; |
| 10 | my $post_diag; |
| 11 | |
| 12 | $modules{$_} = $_ for qw( |
| 13 | ExtUtils::MakeMaker |
| 14 | Perl::Critic |
| 15 | Perl::Critic::Policy |
| 16 | Perl::Critic::Utils |
| 17 | Test::More |
| 18 | ); |
| 19 | |
| 20 | |
| 21 | |
| 22 | my @modules = sort keys %modules; |
| 23 | |
| 24 | sub spacer () |
| 25 | { |
| 26 | diag ''; |
| 27 | diag ''; |
| 28 | diag ''; |
| 29 | } |
| 30 | |
| 31 | pass 'okay'; |
| 32 | |
| 33 | my $max = 1; |
| 34 | $max = $_ > $max ? $_ : $max for map { length $_ } @modules; |
| 35 | our $format = "%-${max}s %s"; |
| 36 | |
| 37 | spacer; |
| 38 | |
| 39 | my @keys = sort grep /(MOJO|PERL|\A(LC|HARNESS)_|\A(SHELL|LANG)\Z)/i, keys %ENV; |
| 40 | |
| 41 | if(@keys > 0) |
| 42 | { |
| 43 | diag "$_=$ENV{$_}" for @keys; |
| 44 | |
| 45 | if($ENV{PERL5LIB}) |
| 46 | { |
| 47 | spacer; |
| 48 | diag "PERL5LIB path"; |
| 49 | diag $_ for split $Config{path_sep}, $ENV{PERL5LIB}; |
| 50 | |
| 51 | } |
| 52 | elsif($ENV{PERLLIB}) |
| 53 | { |
| 54 | spacer; |
| 55 | diag "PERLLIB path"; |
| 56 | diag $_ for split $Config{path_sep}, $ENV{PERLLIB}; |
| 57 | } |
| 58 | |
| 59 | spacer; |
| 60 | } |
| 61 | |
| 62 | diag sprintf $format, 'perl', "$] $^O $Config{archname}"; |
| 63 | |
| 64 | foreach my $module (@modules) |
| 65 | { |
| 66 | my $pm = "$module.pm"; |
| 67 | $pm =~ s{::}{/}g; |
| 68 | if(eval { require $pm; 1 }) |
| 69 | { |
| 70 | my $ver = eval { $module->VERSION }; |
| 71 | $ver = 'undef' unless defined $ver; |
| 72 | diag sprintf $format, $module, $ver; |
| 73 | } |
| 74 | else |
| 75 | { |
| 76 | diag sprintf $format, $module, '-'; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | if($post_diag) |
| 81 | { |
| 82 | spacer; |
| 83 | $post_diag->(); |
| 84 | } |
| 85 | |
| 86 | spacer; |
| 87 |