ExtUtil...Coverage(3)

πŸ“¦
version 0.05 Β· 2 versions
, in fedora 43

πŸ’… 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 πŸ”₯


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