++ed by:
SZABGAB PERLANCAR SKNPP DBOEHMER KHEDIN

65 PAUSE users
26 non-PAUSE users.

Paul Johnson

NAME

Devel::Cover - Code coverage metrics for Perl

SYNOPSIS

 perl -MDevel::Cover yourprog args
 cover

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

To test an uninstalled module:

 cover -delete
 HARNESS_PERL_SWITCHES=-MDevel::Cover make test
 cover

If the module does not use the t/*.t framework:

 PERL5OPT=-MDevel::Cover make test

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 pluggable 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, subroutine, pod and time coverage information is reported. Statement coverage data should be reasonable, although there may be some statements which are not reported. Branch and condition coverage data should be mostly accurate too, although not always what one might initially expect. Subroutine coverage should be as accurate as statement coverage. 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. See http://lists.perl.org/showlist.cgi?name=perl-qa.

REQUIREMENTS

  • Perl 5.6.1 or greater

    (Perl 5.7.0 is unsupported.)

  • The ability to compile XS extensions.

    This means a working compiler and make program at least.

  • Storable and Digest::MD5

    Both are in the core in Perl 5.8.0 and above.

  • Pod::Coverage

    if you want Pod coverage.

  • Test::Differences

    if the tests fail and you would like nice output telling you why.

OPTIONS

 -blib               - "use blib" and ignore files matching \bt/ (default true
                       iff blib directory exists).
 -coverage criterion - Turn on coverage for the specified criterion.  Criteria
                       include statement, branch, path, subroutine, pod, time,
                       all and none (default all available).
 -db cover_db        - Store results in coverage db (default ./cover_db).
 -dir path           - Directory in which coverage will be collected (default
                       cwd).
 -ignore RE          - Ignore files matching RE.
 -inc path           - Set prefixes of files to ignore (default @INC).
 +inc path           - Append to prefixes of files to ignore.
 -merge val          - Merge databases, for multiple test benches (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
 B
 Pod::Coverage

BUGS

Did I mention that this is alpha code?

See the BUGS file.

VERSION

Version 0.34 - 14th January 2004

LICENCE

Copyright 2001-2004, 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