blib/lib/Bootylicious/DocumentContentLoader.pm

filter: Statementstmt 100% 24 / 24 Branchbran 80.0% 8 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 92.5% 37 / 40 CC 6 SCAR 13.9
CC
6
Cov
94%
load
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.0
« blib/lib/Bootylicious/Document.pm ↑ Summary blib/lib/Bootylicious/ArticleByQueryIterator.pm »
1 package Bootylicious::DocumentContentLoader;
2  
3 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 12 ▶use base 'Mojo::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 12 __PACKAGE__->attr('path');
9  
10 sub load {
11 9 ▶ my $self = shift;
Subroutine load: called CC=6 SCAR=18.0
Pod undocumented
12  
13 9 my $path = $self->path;
14  
15 9 ▶ open my $fh, '<:encoding(UTF-8)', $path or return {};
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<:encoding(UTF-8)", $path or return {} 0 9 9
16 9 ▶ while (my $line = <$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = readline $fh)) 22 3 25
17 22 ▶ last if $line eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $line eq "" 0 22 22
18 22 ▶ last if $line !~ m/^(.*?): /;
Branch: 1 branch
BranchTrueFalseTotal
unless $line =~ /^(.*?): / 6 16 22
19 }
20  
21 9 my $content = '';
22 9 ▶ while (my $line = <$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = readline $fh)) 8 9 17
23 8 $content .= $line;
24 }
25  
26 9 return {content => $content};
27 }
28  
29 12 1;
« blib/lib/Bootylicious/Document.pm ↑ Summary blib/lib/Bootylicious/ArticleByQueryIterator.pm »