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.03
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 Contructs 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 {
35 print "$file\n";
36 my $f = $cover->file($file);
37 for my $criterion ($f->items)
38 {
39 print " $criterion\n";
40 my $c = $f->criterion($criterion);
41 for my $location ($c->items)
42 {
43 my $l = $c->location($location);
44 print " $location @$l\n";
45 }
46 }
47 }
48
49 Data for different criteria will be in different formats, so that will
50 need special handling. This is not yet documented so your best bet for
51 now is to look at some of the simpler reports and/or the source.
52
53 The methods in the above example are actually aliases for methods in
54 Devel::Cover::DB::Base (the base class for all Devel::Cover::DB::*
55 classes):
56
57 · Devel::Cover::DB::Base->values
58
59 Aliased to Devel::Cover::DB::Cover->files,
60 Devel::Cover::DB::File->criteria,
61 Devel::Cover::DB::Criterion->locations, and
62 Devel::Cover::DB::Location->data
63
64 · Devel::Cover::DB::Base->get
65
66 Aliased to Devel::Cover::DB::Cover->file,
67 Devel::Cover::DB::File->criteriom,
68 Devel::Cover::DB::Criterion->location, and
69 Devel::Cover::DB::Location->datum
70
71 Instead of calling $file->criterion("x") you can also call $file->x.
72
73 is_valid
74 my $valid = $db->is_valid;
75
76 Returns true if $db is valid (or looks valid, the function is too lax).
77
79 Devel::Cover
80 Devel::Cover::DB::Base
81 Devel::Cover::DB::Cover
82 Devel::Cover::DB::File
83 Devel::Cover::DB::Criterion
84 Devel::Cover::DB::Location
85
87 Huh?
88
90 Copyright 2001-2013, Paul Johnson (paul@pjcj.net)
91
92 This software is free. It is licensed under the same terms as Perl
93 itself.
94
95 The latest version of this software should be available from my
96 homepage: http://www.pjcj.net
97
98
99
100perl v5.16.3 2013-05-20 Devel::Cover::DB(3)