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   49 use strict;
  15         19  
  15         326  
4 15     15   43 use warnings;
  15         17  
  15         301  
5              
6 15     15   47 use base 'Mojo::Base';
  15         43  
  15         2345  
7              
8             __PACKAGE__->attr('path');
9              
10             sub load {
11 14     14 0 196 my $self = shift;
12              
13 14         33 my $path = $self->path;
14              
15 14 50   1   468 open my $fh, '<:encoding(UTF-8)', $path or return {};
  1         4  
  1         1  
  1         5  
16 14         8920 while (my $line = <$fh>) {
17 36 50       161 last if $line eq '';
18 36 100       177 last if $line !~ m/^(.*?): /;
19             }
20              
21 14         19 my $content = '';
22 14         48 while (my $line = <$fh>) {
23 33         95 $content .= $line;
24             }
25              
26 14         191 return {content => $content};
27             }
28              
29             1;