Subject: | The generated 00-compile.t test fails in the new revision with multiple warnings |
t/00-compile.t ......... "my" variable $count masks earlier declaration in same statement at t/00-compile.t line 12.
"my" variable $count masks earlier declaration in same scope at t/00-compile.t line 13.
"my" variable $fail_on_warning masks earlier declaration in same scope at t/00-compile.t line 14.
"my" variable $count masks earlier declaration in same scope at t/00-compile.t line 15.
syntax error at t/00-compile.t line 7, near "use Test::More {
"
Global symbol "$test_more_version" requires explicit package name at t/00-compile.t line 7.
syntax error at t/00-compile.t line 16, near "}"
Global symbol "$needs_display" requires explicit package name at t/00-compile.t line 22.
Global symbol "$fake_home" requires explicit package name at t/00-compile.t line 60.
BEGIN not safe after errors--compilation aborted at t/00-compile.t line 69.
Subject: | 00-compile.t |
#!perl
use strict;
use warnings;
use Test::More;
use File::Find;
use File::Temp qw{ tempdir };
my @modules;
find(
sub {
return if $File::Find::name !~ /\.pm\z/;
my $found = $File::Find::name;
$found =~ s{^lib/}{};
$found =~ s{[/\\]}{::}g;
$found =~ s/\.pm$//;
# nothing to skip
push @modules, $found;
},
'lib',
);
sub _find_scripts {
my $dir = shift @_;
my @found_scripts = ();
find(
sub {
return unless -f;
my $found = $File::Find::name;
# nothing to skip
open my $FH, '<', $_ or do {
note("Unable to open $found in ( $! ), skipping");
return;
};
my $shebang = <$FH>;
return unless $shebang =~ /^#!.*?\bperl\b\s*$/;
push @found_scripts, $found;
},
$dir,
);
return @found_scripts;
}
my @scripts;
do { push @scripts, _find_scripts($_) if -d $_ }
for qw{ bin script scripts };
my $plan = scalar(@modules) + scalar(@scripts);
$plan ? ( plan tests => $plan ) : ( plan skip_all => "no tests to run" );
{
# fake home for cpan-testers
local $ENV{HOME} = tempdir( CLEANUP => 1 );
like( qx{ $^X -Ilib -e "require $_; print '$_ ok'" },
qr/^\s*$_ ok/s, "$_ loaded ok" )
for sort @modules;
SKIP: {
eval "use Test::Script 1.05; 1;";
skip "Test::Script needed to test script compilation", scalar(@scripts)
if $@;
foreach my $file (@scripts) {
my $script = $file;
$script =~ s!.*/!!;
script_compiles( $file, "$script script compiles" );
}
}
}