The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

use 5.006;
use strict;
# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.054
plan tests => 49;
my @module_files = (
'Footprintless.pm',
'Footprintless/App.pm',
'Footprintless/App/Action.pm',
'Footprintless/App/ActionCommand.pm',
'Footprintless/App/Command/config.pm',
'Footprintless/App/Command/deployment.pm',
'Footprintless/App/Command/deployment/clean.pm',
'Footprintless/App/Command/deployment/deploy.pm',
'Footprintless/App/Command/log.pm',
'Footprintless/App/Command/log/cat.pm',
'Footprintless/App/Command/log/follow.pm',
'Footprintless/App/Command/log/grep.pm',
'Footprintless/App/Command/log/head.pm',
'Footprintless/App/Command/log/tail.pm',
'Footprintless/App/Command/overlay.pm',
'Footprintless/App/Command/overlay/clean.pm',
'Footprintless/App/Command/overlay/initialize.pm',
'Footprintless/App/Command/overlay/update.pm',
'Footprintless/App/Command/service.pm',
'Footprintless/App/DocumentationUtil.pm',
'Footprintless/App/UsageException.pm',
'Footprintless/Command.pm',
'Footprintless/CommandOptionsFactory.pm',
'Footprintless/CommandRunner.pm',
'Footprintless/CommandRunner/ExecutionException.pm',
'Footprintless/CommandRunner/IPCRun.pm',
'Footprintless/CommandRunner/IPCRun3.pm',
'Footprintless/Deployment.pm',
'Footprintless/Extract.pm',
'Footprintless/Factory.pm',
'Footprintless/InvalidEntityException.pm',
'Footprintless/Localhost.pm',
'Footprintless/Log.pm',
'Footprintless/MixableBase.pm',
'Footprintless/Mixins.pm',
'Footprintless/Overlay.pm',
'Footprintless/Plugin.pm',
'Footprintless/Resource.pm',
'Footprintless/Resource/Maven.pm',
'Footprintless/Resource/MavenProvider.pm',
'Footprintless/Resource/Provider.pm',
'Footprintless/Resource/Url.pm',
'Footprintless/Resource/UrlProvider.pm',
'Footprintless/ResourceManager.pm',
'Footprintless/Service.pm',
'Footprintless/Tunnel.pm',
'Footprintless/Util.pm'
);
my @scripts = (
'bin/fpl'
);
# no fake home requested
my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib';
open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
my @warnings;
for my $lib (@module_files)
{
# see L<perlfaq8/How can I capture STDERR from an external command?>
my $stderr = IO::Handle->new;
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
and not eval { require blib; blib->VERSION('1.01') };
if (@_warnings)
{
warn @_warnings;
push @warnings, @_warnings;
}
}
foreach my $file (@scripts)
{ SKIP: {
open my $fh, '<', $file or warn("Unable to open $file: $!"), next;
my $line = <$fh>;
close $fh and skip("$file isn't perl", 1) unless $line =~ /^#!\s*(?:\S*perl\S*)((?:\s+-\w*)*)(?:\s*#.*)?$/;
my @flags = $1 ? split(' ', $1) : ();
my $stderr = IO::Handle->new;
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, @flags, '-c', $file);
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$file compiled ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
and not eval { require blib; blib->VERSION('1.01') };
# in older perls, -c output is simply the file portion of the path being tested
if (@_warnings = grep { !/\bsyntax OK$/ }
grep { chomp; $_ ne (File::Spec->splitpath($file))[2] } @_warnings)
{
warn @_warnings;
push @warnings, @_warnings;
}
} }
is(scalar(@warnings), 0, 'no warnings found')
or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) );