File Coverage

blib/lib/Bootylicious/DocumentContentLoader.pm
Criterion Covered Total %
statement 22 22 100.0
branch 4 6 66.6
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 31 34 91.1


line stmt bran cond sub pod time code
1             package Bootylicious::DocumentContentLoader;
2              
3 15     15   68 use strict;
  15         23  
  15         512  
4 15     15   66 use warnings;
  15         113  
  15         387  
5              
6 15     15   70 use base 'Mojo::Base';
  15         70  
  15         3035  
7              
8             __PACKAGE__->attr('path');
9              
10             sub load {
11 14     14 0 301 my $self = shift;
12              
13 14         51 my $path = $self->path;
14              
15 14 50   1   1151 open my $fh, '<:encoding(UTF-8)', $path or return {};
  1         8  
  1         2  
  1         8  
16 14         15421 while (my $line = <$fh>) {
17 36 50       235 last if $line eq '';
18 36 100       273 last if $line !~ m/^(.*?): /;
19             }
20              
21 14         28 my $content = '';
22 14         67 while (my $line = <$fh>) {
23 33         144 $content .= $line;
24             }
25              
26 14         425 return {content => $content};
27             }
28              
29             1;