File Coverage

lib/Perl/Metrics/Simple/Output.pm
Criterion Covered Total %
statement 13 26 50.0
branch 1 2 50.0
condition 1 3 33.3
subroutine 4 7 57.1
pod 0 4 0.0
total 19 42 45.2


line stmt bran cond sub pod time code
1             package Perl::Metrics::Simple::Output;
2              
3 4     4   2046 use strict;
  4         8  
  4         118  
4 4     4   19 use warnings;
  4         8  
  4         142  
5              
6 4     4   25 use Carp qw();
  4         9  
  4         1146  
7              
8             our $VERSION = 'v1.0.3';
9              
10             sub new {
11 4     4 0 2190 my ( $class, $analysis ) = @_;
12              
13 4 50 33     20 if ((! ref $analysis) && ($analysis->isa('Perl::Metrics::Simple::Analysis')) ) {
14 0         0 Carp::confess('Did not pass a Perl::Metrics::Simple::Analysis object.');
15             }
16              
17 4         12 my $self = bless {
18             _analysis => $analysis,
19             }, $class;
20              
21 4         11 return $self;
22             }
23              
24             sub analysis {
25 0     0 0   my ($self) = @_;
26 0           return $self->{'_analysis'};
27             }
28              
29             sub make_report {
30 0     0 0   Carp::confess('Use one of the sub-classes, e.g. Perl::Metrics::Simple::Output::PlainText');
31             }
32              
33             sub make_list_of_subs {
34 0     0 0   my ($self) = @_;
35              
36 0           my $analysis = $self->analysis();
37              
38             my @main_from_each_file
39 0           = map { $_->{main_stats} } @{ $analysis->file_stats() };
  0            
  0            
40 0           my @sorted_all_subs = reverse sort { $a->{'mccabe_complexity'} <=> $b->{'mccabe_complexity'} } ( @{ $analysis->subs() }, @main_from_each_file );
  0            
  0            
41              
42 0           return [ \@main_from_each_file, \@sorted_all_subs ];
43             }
44              
45             1; # Keep Perl happy, snuggy, and warm.
46              
47             __END__