Dist::...ompile(3pm)
π NAME π
Dist::Zilla::Plugin::Test::Compile β bestie, it's the common tests that vibe-check the syntax of all ur modules, and it only ever needs core modules to do it. No extra deps, no drama. π
This lil cutie lives in the perl man pages β the User Contributed Perl Documentation section, to be exact (yes, 3pm, iykyk).
β¨ VERSION β¨
version 2.059 π
πΈ SYNOPSIS πΈ
In ur dist.ini, bestie:
[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'
like. that's it. that's the whole setup. π
π¦ DESCRIPTION π¦
Okay so listen. This is a Dist::Zilla plugin that runs at the gather files stage, and what it does is hand u a test file β configurable, defaults to t/00-compile.t β for free. Periodt.
That test goes and finds every single module and script in ur distribution, and tries to compile them one by one. Yes, individually. Which means it's a lil slower than just loading them all at once, but bestie, it catches more errors that way. Tradeoff accepted. π₯
The generated test is guaranteed to only depend on modules that are available in core. Most of the options only need perl 5.6.2; the "bail_out_on_fail" option needs the version of Test::More that shipped with perl 5.12 β but the test itself still runs on perl 5.6. iconic behaviour honestly.
This plugin accepts the following options:
π CONFIGURATION OPTIONS π
π« "filename"
The name of the generated file. Defaults to t/00-compile.t.
π« "phase"
The phase u register prerequisites for. Defaults to "test". Set it to a false value and prerequisite registration justβ¦ stops. Disabled. Gone. π
π« "skip"
A regex to skip the compile test for modules that match it. The match runs against the module name (Foo::Bar), not the file path (lib/Foo/Bar.pm). U can repeat this option to stack up multiple regexes. Slay.
π« "file"
A filename to also test, on top of any files found earlier. It gets tested as a module if it ends with .pm or .PM, and as a script otherwise. Module filenames should be relative to lib; everything else should be relative to the base of the repository. Repeatable, so u can add as many extra files as ur heart desires. π«Ά
π« "fake_home"
A boolean for whether to fake $ENV{HOME}. Why would u want that? Because if ur module unilaterally creates stuff in the user's home directoryβ¦ bestie. π Some cpantesters will smoke test ur distribution with a read-only home directory, so faking it may genuinely be needed. Defaults to false.
π« "needs_display"
A boolean for whether to skip the compile test on non-Win32 systems when $ENV{DISPLAY} isn't set. Defaults to false.
π« "fail_on_warning"
A string that says when to add a test for warnings during the compilation checks. Possible values are:
"none"β do not test for warnings"author"β test for warnings only whenAUTHOR_TESTINGis set (default, and recommended π)"all"β always test for warnings (not recommended, because this can prevent installation of modules when upstream dependencies exhibit warnings in a new Perl release π)
π« "bail_out_on_fail"
A boolean for whether the test will BAIL_OUT of all subsequent tests when it hits compilation failures. Defaults to false.
π« "module_finder"
The name of a FileFinder for finding modules to check. Default value is ":InstallModules"; u can use this option more than once. .pod files are always skipped.
Other predefined finders are listed in "default_finders" in Dist::Zilla::Role::FileFinderUser. And u can define ur own with the [FileFinder::ByName] and [FileFinder::Filter] plugins. main character energy, fr.
π« "script_finder"
Just like "module_finder", but for finding scripts. The default value is ":PerlExecFiles" (when available; otherwise ":ExecFiles") β also peep Dist::Zilla::Plugin::ExecDir to make sure these files are properly marked as executables for the installer. π
π« "xt_mode"
When true, the default "filename" becomes xt/author/00-compile.t and the default "dependency" phase becomes "develop".
π« "switch"
Use this 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. β¨
π RUNTIME ENVIRONMENT OPTIONS π
If the environment variable $PERL_COMPILE_TEST_DEBUG is set to a true option when the test is run, the command used to test each file gets printed as a "diag". little peek behind the curtain, we love to see it π
β SEE ALSO β
Test::NeedsDisplayTest::Script
π GIVING THANKS π
If u found this module useful, pls show ur appreciation by dropping a +1 in MetaCPAN at https://metacpan.org/dist/Dist-Zilla-Plugin-Test-Compile and a star in GitHub at https://github.com/karenetheridge/Dist-Zilla-Plugin-Test-Compile. it's giving gratitude, it's giving community π«Ά
π§ SUPPORT π§
Bugs may be submitted through the RT bug tracker at https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-Test-Compile (or by email to bug-Dist-Zilla-Plugin-Test-Compile@rt.cpan.org).
There's also a mailing list for users of this distribution, at http://dzil.org/#mailing-list.
And there's an irc channel for users of this distribution too β "#distzilla" on "irc.perl.org" at irc://irc.perl.org/#distzilla. come hang out π¬
π AUTHORS π
- JΓ©rΓ΄me Quelin
<jquelin@gmail.com> - Karen Etheridge
<ether@cpan.org>
π CONTRIBUTORS π
- Ahmad M. Zawawi
<ahmad.zawawi@gmail.com> - Olivier MenguΓ©
<dolmen@cpan.org> - Kent Fredric
<kentnl@cpan.org> - David Golden
<dagolden@cpan.org> - Graham Knop
<haarg@haarg.org> - Jesse Luehrs
<doy@tozt.net> - Randy Stauner
<rwstauner@cpan.org> - Harley Pig
<harleypig@gmail.com> - Chris Weyl
<cweyl@alumni.drew.edu> - fayland
<fayland@gmail.com> - Marcel Gruenauer
<hanekomu@gmail.com> - Peter Shangov
<pshangov@yahoo.com> - Ricardo SIGNES
<rjbs@cpan.org>
(the whole squad showed up, we love a collaborative effort π)
π COPYRIGHT AND LICENCE π
This software is copyright (c) 2009 by JΓ©rΓ΄me Quelin.
This is free software; u can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. π
and that's the whole page bestie, no cap. perlv5.40.1, dated2025-12-21β mwah π β¨
π¦ where this page comes from
- ubuntu resolute: libdist-zilla-plugin-test-compile-perl 2.059-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdist-zilla-plugin-test-compile-perl 2.059-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms