ExtUtil...Coverage(3)
π NAME π
okay so bestie, <pink>ExtUtils::MakeMaker::Coverage</pink> is the whole vibe here β it's the module that adds a Makefile target so you can figure out your test coverage using <purple>Devel::Cover</purple>. that's it, that's the girl. π
β¨ VERSION β¨
Version <cyan>0.05</cyan> β yes she's an older queen but she's still serving. π
π¦ SYNOPSIS π¦
so here's the tea: this module slides an extra target into the Makefile that <pink>ExtUtils::MakeMaker</pink> generates for you. that target is called <hotpink>testcover</hotpink>, and when you call it, it runs <purple>cover</purple> β the command-line script that generates test coverage statistics β to clean up any data from a previous run. then it runs your tests, literally as if you'd typed <cyan>make test</cyan>, and then it calls <purple>cover</purple> again to actually generate the coverage stats. she does the whole routine, no skips. π
# In Makefile.PL
use ExtUtils::MakeMaker;
use ExtUtils::MakeMaker::Coverage;
...
# if you already have a MY::postamble...
sub MY::postamble {
testcover();
...
}
# if you wish to tweak the testcover target that will be written,
# alter it's configuration.
$conf = ExtUtils::MakeMaker::Coverage->config;
and then in your shell, go off:
> perl Makefile.PL
> make
> make testcover
πΈ METHODS πΈ
testcover
this method is <mint>exported</mint> for when you've already got a <cyan>MY::postamble</cyan> chillin' in your <cyan>Makefile.PL</cyan>. in that case, just add a call to the <hotpink>testcover</hotpink> method and boom, the necessary Makefile steps get added. it's giving plug-and-play, honestly. π«Ά
config
this method hands you back the internal config object that this package uses to build the <hotpink>testcover</hotpink> target in the Makefile. it's literally the control room. ποΈ
you can change parts of the <hotpink>testcover</hotpink> target by setting accessors on this object. here's every single one, don't skip:
binaryβ the value to use for the<purple>cover</purple>binary. defaults to<cyan>cover</cyan>.formatβ the output format to use for<cyan>cover -report</cyan>. defaults to none, which means it uses<purple>cover</purple>'s default settings. go consult<cyan>perldoc cover</cyan>for documentation on its<cyan>-report</cyan>switch. β¨ignoreβ an array ref of patterns to ignore when generating the coverage report. defaults to an empty list.<cyan>perldoc cover</cyan>has the docs on its<cyan>-ignore</cyan>switch, bestie.filesβ an array ref of test files to run for this coverage reprort. defaults to the<cyan>$(TESTFILES)</cyan>variable as defined in your<cyan>Makefile</cyan>. for details, consult<cyan>perldoc ExtUtils::MakeMaker</cyan>. (yes the original says "reprort", she's quirky like that, we don't fix her π)cover_statementβ boolean indicating whether to run coverage on statements. defaults to<cyan>true</cyan>.<cyan>perldoc cover</cyan>explains its<cyan>-coverage</cyan>switch.cover_branchβ boolean indicating whether to run coverage on branches. defaults to<cyan>true</cyan>. again,<cyan>perldoc cover</cyan>and its<cyan>-coverage</cyan>switch.cover_subroutineβ boolean indicating whether to run coverage on subroutines. defaults to<cyan>true</cyan>.<cyan>perldoc cover</cyan>,<cyan>-coverage</cyan>switch, you know the drill.cover_conditionβ boolean indicating whether to run coverage on conditions. defaults to<cyan>true</cyan>. same energy:<cyan>perldoc cover</cyan>,<cyan>-coverage</cyan>switch.cover_podβ boolean indicating whether to run coverage on POD. defaults to<cyan>true</cyan>. and yep,<cyan>perldoc cover</cyan>documents its<cyan>-coverage</cyan>switch.
Example, because examples slay:
$config = ExtUtils::MakeMaker::Coverage->config;
$config->pod(0); # disable pod coverage
$config->files(['t/1.t', 't/2.t']); # use these test files only
$config->ignore(['SCCS']); # ignore files with these
# patterns in their path
π NOTES π
lowkey this is alpha quality code in terms of features, bestie. for this module to be usable for as many modules as possible, the following additional features are needed:
- BSD make β from my testing, if you run the testcover step using a BSD make, you will get coverage statistics for the test scripts. this is not at all useful.
<yellow>gmake is suggested until this issue is resolved.</yellow>π¨ - nmake β I have not tested this enough with nmake. I have done some initial changes to make it work, but it requires more refactoring to get to where I'd like to see it. expect full support in a release or two. π
π AUTHOR π
Steve Peters, <cyan>"<steve@fisharerojo.org>"</cyan> β give her her flowers. π
π BUGS π
please report any bugs or feature requests to <cyan>"bug-extutils-makemaker-coverage@rt.cpan.org"</cyan>, or through the web interface at <cyan><http://rt.cpan.org></cyan>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. teamwork makes the dream work fr fr. π€
π ACKNOWLEDGEMENTS π
- Paul Johnson β for developing
<purple>Devel::Cover</purple>and enduring my many questions on IRC. absolute legend behavior. π - Andy Lester β for helping to make me a test-infected Perl programmer. iconic. β
- Jos Boumans β for making many of the changes for the 0.05 release, including the testcover script. goat. π
π₯ SEE ALSO π₯
<purple>Devel::Cover</purple><cyan><http://qa.perl.org></cyan>
π COPYRIGHT & LICENSE π
Copyright 2005 Steve Peters, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
okay bestie that's the whole page, you ate it up. this was the <pink>ExtUtils::MakeMaker::Coverage</pink> manpage, section <cyan>3</cyan>, from <purple>perl v5.42.0</purple>, dated <mint>2025-07-25</mint>. go get that coverage, no cap. π
β¨π¦
π¦ where this page comes from
- fedora 43: perl-ExtUtils-MakeMaker-Coverage 0.05-51.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms