blib/lib/App/Prove/Elasticsearch/Indexer/DzilDist.pm

filter: Statementstmt 100% 21 / 21 Branchbran 83.3% 5 / 6 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 96.9% 32 / 33 CC 1 SCAR 0.0
CC
1
Cov
97%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/App/Prove/Elasticsearch/Indexer/MMDist.pm ↑ Summary blib/lib/App/Prove/Elasticsearch/Blamer/Git.pm »
1 # ABSTRACT: Names your elasticsearch index after your distribution as defined in dist.ini
2 # PODNAME: App::Prove::Elasticsearch::Indexer::DzilDist
3  
4 package App::Prove::Elasticsearch::Indexer::DzilDist;
5 2 $App::Prove::Elasticsearch::Indexer::DzilDist::VERSION = '0.001';
6 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 ▶use parent qw{App::Prove::Elasticsearch::Indexer};
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 #Basically, do this:
12 #our $index = `awk '/^name/ {print \$NF}' dist.ini`;
13  
14 2 our $index = __CLASS__->SUPER::index;
15 2 ▶our $dfile //= 'dist.ini';
Condition100%2/2
our $dfile //= "dist.ini"
l!l
11
MC/DC100%1/1
our $dfile //= "dist.ini"
our $dfile
Truth table100%2/2
A
A= our $dfile
Aresult
11
00
16  
17 2 ▶if (open(my $dh, '<', $dfile)) {
Branch: 1 branch
BranchTrueFalseTotal
if (open my $dh, '<', $App::Prove::Elasticsearch::Indexer::DzilDist::dfile) { } 1 1 2
18 1 ▶ while (<$dh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $dh)) 8 0 8
19 8 ($index) = $_ =~ /^name\s*?=\s*?(.*)/;
20 8 ▶ if ($index) {
Branch: 1 branch
BranchTrueFalseTotal
if ($App::Prove::Elasticsearch::Indexer::DzilDist::index) 1 7 8
21 1 $index =~ s/^\s+//;
22 1 last;
23 }
24 }
25 1 close $dh;
26 } else {
27 1 print
28 "# WARNING: Could not open $dfile, falling back to index name '$index'\n";
29 }
30  
31 2 1;
32  
33 __END__
« blib/lib/App/Prove/Elasticsearch/Indexer/MMDist.pm ↑ Summary blib/lib/App/Prove/Elasticsearch/Blamer/Git.pm »