1Devel::Cover::DB(3) User Contributed Perl Documentation Devel::Cover::DB(3)
2
3
4
6 Devel::Cover::DB - Code coverage metrics for Perl
7
9 version 1.36
10
12 use Devel::Cover::DB;
13
14 my $db = Devel::Cover::DB->new(db => "my_coverage_db");
15 $db->print_summary([$file1, $file2], ["statement", "pod"]);
16
18 This module provides access to a database of code coverage information.
19
21 new
22 my $db = Devel::Cover::DB->new(db => "my_coverage_db");
23
24 Constructs the DB from the specified database.
25
26 cover
27 my $cover = $db->cover;
28
29 Returns a Devel::Cover::DB::Cover object. From here all the coverage
30 data may be accessed.
31
32 my $cover = $db->cover;
33 for my $file ($cover->items) {
34 print "$file\n";
35 my $f = $cover->file($file);
36 for my $criterion ($f->items) {
37 print " $criterion\n";
38 my $c = $f->criterion($criterion);
39 for my $location ($c->items) {
40 my $l = $c->location($location);
41 print " $location @$l\n";
42 }
43 }
44 }
45
46 Data for different criteria will be in different formats, so that will
47 need special handling. This is not yet documented so your best bet for
48 now is to look at some of the simpler reports and/or the source.
49
50 The methods in the above example are actually aliases for methods in
51 Devel::Cover::DB::Base (the base class for all Devel::Cover::DB::*
52 classes):
53
54 • Devel::Cover::DB::Base->values
55
56 Aliased to Devel::Cover::DB::Cover->files,
57 Devel::Cover::DB::File->criteria,
58 Devel::Cover::DB::Criterion->locations, and
59 Devel::Cover::DB::Location->data
60
61 • Devel::Cover::DB::Base->get
62
63 Aliased to Devel::Cover::DB::Cover->file,
64 Devel::Cover::DB::File->criterion,
65 Devel::Cover::DB::Criterion->location, and
66 Devel::Cover::DB::Location->datum
67
68 Instead of calling $file->criterion("x") you can also call $file->x.
69
70 is_valid
71 my $valid = $db->is_valid;
72
73 Returns true if $db is valid (or looks valid, the function is too lax).
74
76 Devel::Cover
77 Devel::Cover::DB::Base
78 Devel::Cover::DB::Cover
79 Devel::Cover::DB::File
80 Devel::Cover::DB::Criterion
81 Devel::Cover::DB::Location
82
84 Huh?
85
87 Copyright 2001-2019, Paul Johnson (paul@pjcj.net)
88
89 This software is free. It is licensed under the same terms as Perl
90 itself.
91
92 The latest version of this software should be available from my
93 homepage: http://www.pjcj.net
94
95
96
97perl v5.32.1 2021-01-27 Devel::Cover::DB(3)