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   81 use strict;
  15         31  
  15         339  
4 15     15   67 use warnings;
  15         29  
  15         316  
5              
6 15     15   113 use base 'Mojo::Base';
  15         45  
  15         2397  
7              
8             __PACKAGE__->attr('path');
9              
10             sub load {
11 14     14 0 210 my $self = shift;
12              
13 14         42 my $path = $self->path;
14              
15 14 50   1   433 open my $fh, '<:encoding(UTF-8)', $path or return {};
  1         6  
  1         2  
  1         6  
16 14         9089 while (my $line = <$fh>) {
17 36 50       217 last if $line eq '';
18 36 100       1777 last if $line !~ m/^(.*?): /;
19             }
20              
21 14         34 my $content = '';
22 14         49 while (my $line = <$fh>) {
23 33         123 $content .= $line;
24             }
25              
26 14         193 return {content => $content};
27             }
28              
29             1;