Dist::Zilla::Plugin::Test::Compile - Common tests to check syntax of your modules, using only core modules
version 2.058
In your dist.ini:
[Test::Compile] skip = Test$ fake_home = 1 needs_display = 1 fail_on_warning = author bail_out_on_fail = 1 switch = -M-warnings=numeric ; like "no warnings 'numeric'
This is a Dist::Zilla plugin that runs at the gather files stage, providing a test file (configurable, defaulting to t/00-compile.t).
This test will find all modules and scripts in your distribution, and try to compile them one by one. This means it's a bit slower than loading them all at once, but it will catch more errors.
The generated test is guaranteed to only depend on modules that are available in core. Most options only require perl 5.6.2; the bail_out_on_fail option requires the version of Test::More that shipped with perl 5.12 (but the test still runs on perl 5.6).
bail_out_on_fail
This plugin accepts the following options:
filename
The name of the generated file. Defaults to t/00-compile.t
phase
The phase for which to register prerequisites. Defaults to test. Setting this to a false value will disable prerequisite registration.
test
skip
A regex to skip compile test for modules matching it. The match is done against the module name (Foo::Bar), not the file path (lib/Foo/Bar.pm). This option can be repeated to specify multiple regexes.
Foo::Bar
file
A filename to also test, in addition to any files found earlier. It will be tested as a module if it ends with .pm or .PM, and as a script otherwise. Module filenames should be relative to lib; others should be relative to the base of the repository. This option can be repeated to specify multiple additional files.
.pm
.PM
fake_home
A boolean to indicate whether to fake $ENV{HOME}. This may be needed if your module unilaterally creates stuff in the user's home directory: indeed, some cpantesters will smoke test your distribution with a read-only home directory. Defaults to false.
$ENV{HOME}
needs_display
A boolean to indicate whether to skip the compile test on non-Win32 systems when $ENV{DISPLAY} is not set. Defaults to false.
$ENV{DISPLAY}
fail_on_warning
A string to indicate when to add a test for warnings during compilation checks. Possible values are:
none: do not test for warnings
none
author: test for warnings only when AUTHOR_TESTING is set (default, and recommended)
author
all: always test for warnings (not recommended, as this can prevent installation of modules when upstream dependencies exhibit warnings in a new Perl release)
all
A boolean to indicate whether the test will BAIL_OUT of all subsequent tests when compilation failures are encountered. Defaults to false.
module_finder
This is the name of a FileFinder for finding modules to check. The default value is :InstallModules; this option can be used more than once. .pod files are always skipped.
:InstallModules
Other predefined finders are listed in "default_finders" in Dist::Zilla::Role::FileFinderUser. You can define your own with the [FileFinder::ByName] and [FileFinder::Filter] plugins.
script_finder
Just like module_finder, but for finding scripts. The default value is :PerlExecFiles (when available; otherwise :ExecFiles) -- see also Dist::Zilla::Plugin::ExecDir, to make sure these files are properly marked as executables for the installer.
:PerlExecFiles
:ExecFiles
xt_mode
When true, the default filename becomes xt/author/00-compile.t and the default dependency phase becomes develop.
dependency
develop
switch
Use this option to pass a command-line switch (e.g. -d:Confess, -M-warnings=numeric) to the command that tests the module or script. Can be used more than once. See perlrun for more on constructing these switches.
-d:Confess
-M-warnings=numeric
If the environment variable $PERL_COMPILE_TEST_DEBUG is set to a true option when the test is run, the command to test each file will be printed as a diag.
$PERL_COMPILE_TEST_DEBUG
diag
Test::NeedsDisplay
Test::Script
Bugs may be submitted through the RT bug tracker (or bug-Dist-Zilla-Plugin-Test-Compile@rt.cpan.org).
There is also a mailing list available for users of this distribution, at http://dzil.org/#mailing-list.
There is also an irc channel available for users of this distribution, at #distzilla on irc.perl.org.
#distzilla
irc.perl.org
Jérôme Quelin <jquelin@gmail.com>
Karen Etheridge <ether@cpan.org>
Ahmad M. Zawawi <ahmad.zawawi@gmail.com>
Olivier Mengué <dolmen@cpan.org>
Kent Fredric <kentnl@cpan.org>
Jesse Luehrs <doy@tozt.net>
David Golden <dagolden@cpan.org>
Randy Stauner <rwstauner@cpan.org>
Harley Pig <harleypig@gmail.com>
Graham Knop <haarg@haarg.org>
fayland <fayland@gmail.com>
Peter Shangov <pshangov@yahoo.com>
Chris Weyl <cweyl@alumni.drew.edu>
Ricardo SIGNES <rjbs@cpan.org>
Marcel Gruenauer <hanekomu@gmail.com>
This software is copyright (c) 2009 by Jérôme Quelin.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Dist::Zilla::Plugin::Test::Compile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dist::Zilla::Plugin::Test::Compile
CPAN shell
perl -MCPAN -e shell install Dist::Zilla::Plugin::Test::Compile
For more information on module installation, please visit the detailed CPAN module installation guide.