Harriet.pm

filter: Statementstmt 41.6% 10 / 24 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 0.0% 0 / 3 totaltotal 30.2% 13 / 43 CC 6 SCAR 24.0
CC
6
Cov
29%
load_all
20.0
load
12.0
new
2.0
CRAP 11.0
↑ Summary App/Prove/Plugin/Harriet.pm »
1 package Harriet;
2 1 ▶use 5.008005;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = "0.06";
7  
8 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
9 0 my ($class, $dir) = @_;
10 0 bless {dir => $dir}, $class;
11 }
12  
13 0 ▶sub load {
Subroutine load: not called CC=3 SCAR=24.8
Pod undocumented
14 0 my ($self, $name) = @_;
15 0 ▶ return if $self->{loaded}->{$name}++;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"loaded"}{$name}++ 0 0 0
16  
17 0 my $file = "$self->{dir}/${name}.pl";
18  
19 0 my $retval = do $file;
20 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
21 0 die "[Harriet] Couldn't parse $file: $@\n";
22 }
23 }
24  
25 0 ▶sub load_all {
Subroutine load_all: not called CC=4 SCAR=30.0
Pod undocumented
26 0 my ($self) = @_;
27  
28 opendir my $dh, $self->{dir}
29 0 ▶ or die "[Harriet] Cannot open '$self->{dir}' as directory: $!\n";
Branch: 1 branch
BranchTrueFalseTotal
opendir my $dh, $self->{"dir"} or die qq[[Harriet] Cannot open '$self->{"dir"}' as directory: $!\n] 0 0 0
30 0 ▶ while (my $file = readdir($dh)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $file = readdir $dh)) 0 0 0
31 0 ▶ next unless $file =~ /^(.*)\.pl$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $file =~ /^(.*)\.pl$/ 0 0 0
32 0 my $name = $1;
33 0 $self->load($name);
34 }
35 }
36  
37 1 1;
38 __END__
↑ Summary App/Prove/Plugin/Harriet.pm »