Devel::Cover::DB - Code coverage metrics for Perl
use Devel::Cover::DB; my $db = Devel::Cover::DB->new(db => "my_coverage_db"); $db->print_summary(statement => 1, pod => 1); $db->print_details;
This module provides access to a database of code coverage information.
Devel::Cover
my $db = Devel::Cover::DB->new(db => "my_coverage_db");
Contructs the DB from the specified database.
my $cover = $db->cover;
Returns a Devel::Cover::DB::Cover object. From here all the coverage data may be accessed.
my $cover = $db->cover; for my $file ($cover->items) { print "$file\n"; my $f = $cover->file($file); for my $criterion ($f->items) { print " $criterion\n"; my $c = $f->criterion($criterion); for my $location ($c->items) { my $l = $c->location($location); print " $location @$l\n"; } } }
Data for different criteria will be in different formats, so that will need special handling, but I'll deal with that when we have the data for different criteria.
If you don't want to remember all the method names, use values() instead of files(), criteria() and locations() and get() instead of file(), criterion() and location().
Instead of calling $file->criterion("x") you can also call $file->x.
my $valid = $db->is_valid;
Returns true iff the db is valid. (Actually there is one too many fs there, but that's what it should do.)
Huh?
Version 0.74 - 16th April 2011
Copyright 2001-2011, 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
To install Devel::Cover, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Devel::Cover
CPAN shell
perl -MCPAN -e shell install Devel::Cover
For more information on module installation, please visit the detailed CPAN module installation guide.