The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Devel::Cover - Code coverage metrics for Perl

SYNOPSIS

 perl -MDevel::Cover yourprog args
 cover cover_db -report html

 perl -MDevel::Cover=-db,cover_db,-coverage,statement,time yourprog args

DESCRIPTION

This module provides code coverage metrics for Perl.

If you can't guess by the version number this is an alpha release.

Code coverage data are collected using a plugable runops function which counts how many times each op is executed. These data are then mapped back to reality using the B compiler modules. There is also a statement profiling facility which needs a better backend to be really useful.

The cover program can be used to generate coverage reports.

Statement, branch, condition, pod and time coverage information is reported. Statement coverage data should be reasonable, although there may be some statements which are not reported. Branch coverage data should be mostly accurate too. Condition coverage data are only available for && and || ops. These data should be mostly accurate, although not always what one might initially expect. Pod coverage comes from Pod::Coverage. Coverage data for path coverage are not yet collected.

The gcov2perl program can be used to convert gcov files to Devel::Cover databases.

You may find that the results don't match your expectations. I would imagine that at least one of them is wrong.

THe most appropriate mailing list on which to discuss this module would be perl-qa. Discussion has migrated there from perl-qa-metrics which is now defunct. http://lists.perl.org/showlist.cgi?name=perl-qa

Requirements:

  Perl 5.6.1 or 5.7.1.
  The ability to compile XS extensions.
  Pod::Coverage if you want pod coverage.
  Template Toolkit 2 if you want HTML output.

OPTIONS

 -coverage criterion - Turn on coverage for the specified criterion.
 -db cover_db        - Store results in coverage db (default cover_db).
 -inc path           - Set prefixes of files to ignore (default @INC).
 +inc path           - Append to prefixes of files to ignore.
 -ignore RE          - Ignore files matching RE.
 -indent indent      - Set indentation level to indent.  Don't use this.
 -merge val          - Merge databases, for multiple test benches (default on).
 -profile val        - Turn on profiling iff val is true (default on).
 -select RE          - Only report on files matching RE.
 -summary val        - Print summary information iff val is true (default on).

ACKNOWLEDGEMENTS

Some code and ideas cribbed from:

 Devel::OpProf
 B::Concise
 B::Deparse

SEE ALSO

 Devel::Cover::Tutorial
 Data::Dumper
 B
 Pod::Coverage

BUGS

Did I mention that this is alpha code?

VERSION

Version 0.16 - 9th September 2002

LICENCE

Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)

This software is free. It is licensed under the same terms as Perl itself.

The latest version of this software should be available from my homepage: http://www.pjcj.net