File Coverage

lib/Code/Statistics/Metric.pm
Criterion Covered Total %
statement 23 25 92.0
branch n/a
condition n/a
subroutine 9 10 90.0
pod 5 5 100.0
total 37 40 92.5


line stmt bran cond sub pod time code
1 1     1   6 use strict;
  1         2  
  1         33  
2 1     1   5 use warnings;
  1         2  
  1         63  
3              
4             package Code::Statistics::Metric;
5             {
6             $Code::Statistics::Metric::VERSION = '1.112980';
7             }
8              
9             # ABSTRACT: base class for Code::Statistic metrics
10              
11 1     1   21 use 5.004;
  1         3  
  1         37  
12              
13 1     1   753 use Module::Pluggable search_path => __PACKAGE__, require => 1, sub_name => 'all';
  1         794  
  1         5  
14              
15              
16             sub measure {
17 0     0 1 0 my ( $class, $target ) = @_;
18 0         0 return;
19             }
20              
21              
22             sub incompatible_with {
23 192     192 1 481 my ( $class, $target ) = @_;
24 192         508 return 0;
25             }
26              
27              
28             sub force_support {
29 256     256 1 323 my ( $class, $target ) = @_;
30 256         748 return 0;
31             }
32              
33              
34             sub short_name {
35 140     140 1 155 my ( $class ) = @_;
36 140         303 $class =~ s/Code::Statistics::Metric:://;
37 140         404 return $class;
38             }
39              
40              
41             sub is_insignificant {
42 12     12 1 16 my ( $class ) = @_;
43 12         39 return 0;
44             }
45              
46              
47             sub import {
48 2     2   9 Code::Statistics::Metric->all;
49 2         28651 return;
50             }
51              
52             1;
53              
54             __END__
55             =pod
56              
57             =head1 NAME
58              
59             Code::Statistics::Metric - base class for Code::Statistic metrics
60              
61             =head1 VERSION
62              
63             version 1.112980
64              
65             =head2 measure
66             Returns the metric of the given target.
67             Is called with the metric class name and a target object of unspecified
68             type.
69             This function should be overridden with specific logic to actually retrieve
70             the metric data.
71              
72             =head2 incompatible_with
73             Returns true if the given target is explicitly not supported by this metric.
74             Is called with the metric class name and a string representing the target
75             identifiers after 'Code::Statistics::Target::'.
76             Default is that all metrics are compatible with all targets.
77              
78             =head2 force_support
79             Returns true if the given target is forcibly supported by this metric.
80             Is called with the metric class name and a string representing the target
81             identifiers after 'Code::Statistics::Target::'.
82             Default is that no forcing happens.
83              
84             Has higher precedence than 'incompatible_with' and should be used to
85             override incompatibilities set by other targets.
86              
87             =head2 short_name
88             Allows a metric to return a short name, which can be used by shell report
89             builders for example.
90             Default is the class name, with 'Code::Statistics::Metric::' stripped out.
91             Override to customize.
92              
93             =head2 is_insignificant
94             Returns true if the metric is considered statistically insignificant.
95             Default is false.
96              
97             =head2 import
98              
99             Custom import to ensure that all possible metric plugins are loaded when
100             this module is loaded.
101              
102             =head1 AUTHOR
103              
104             Christian Walde <mithaldu@yahoo.de>
105              
106             =head1 COPYRIGHT AND LICENSE
107              
108             This software is Copyright (c) 2010 by Christian Walde.
109              
110             This is free software, licensed under:
111              
112             DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE, Version 2, December 2004
113              
114             =cut
115