blib/lib/App/Prove/Elasticsearch/Blamer/Default.pm

filter: Statementstmt 100% 29 / 29 Branchbran 100% 10 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 100% 46 / 46 CC 6 SCAR 13.2
CC
6
Cov
100%
get_responsible_party
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.7
« blib/lib/App/Prove/Elasticsearch/Versioner/Default.pm ↑ Summary blib/lib/App/Prove/Elasticsearch/Harness.pm »
1 # ABSTRACT: Determine the responsible for tests via Changes file for upload to elasticsearch
2 # PODNAME: App::Prove::Elasticsearch::Blamer::Default
3  
4 package App::Prove::Elasticsearch::Blamer::Default;
5 3 $App::Prove::Elasticsearch::Blamer::Default::VERSION = '0.001';
6 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 3 ▶use File::Basename qw{dirname};
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use Cwd qw{abs_path};
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 our $party = {};
14  
15 4 ▶sub get_responsible_party {
Subroutine get_responsible_party: called CC=6 SCAR=17.9
Pod documented
16 4 my $loc = abs_path(dirname(shift) . "/../Changes");
17  
18 4 ▶ return $party->{$loc} if $party->{$loc};
Branch: 1 branch
BranchTrueFalseTotal
if $App::Prove::Elasticsearch::Blamer::Default::party->{$loc} 1 3 4
19 3 my $ret;
20 3 ▶ open(my $fh, '<', $loc) or die "Could not open $loc";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $loc or die "Could not open $loc" 2 1 3
21 2 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 3 1 4
22 3 ($ret) = $_ =~ m/\s*\w*\s*(\w*)$/;
23 3 ▶ last if $ret;
Branch: 1 branch
BranchTrueFalseTotal
if $ret 1 2 3
24 }
25 2 close $fh;
26 2 ▶ die 'Could not determine the latest version from Changes!' unless $ret;
Branch: 1 branch
BranchTrueFalseTotal
unless $ret 1 1 2
27 1 $party->{$loc} = $ret;
28 1 return $ret;
29 }
30  
31 3 1;
32  
33 __END__
« blib/lib/App/Prove/Elasticsearch/Versioner/Default.pm ↑ Summary blib/lib/App/Prove/Elasticsearch/Harness.pm »