blib/lib/Dir/Manifest/Slurp.pm

filter: Statementstmt 96.1% 25 / 26 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 94.7% 36 / 38 SCAR 11.0
CC
3
Cov
93%
slurp
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« blib/lib/Dir/Manifest.pm ↑ Summary blib/lib/Dir/Manifest/Key.pm »
1 package Dir::Manifest::Slurp;
2 4 $Dir::Manifest::Slurp::VERSION = '0.4.0';
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use Socket qw(:crlf);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 ▶use parent qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 our %EXPORT_TAGS = ( 'all' => [qw( as_lf slurp )] );
10 4 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
11 4 our @EXPORT = qw();
12  
13 sub as_lf
14 {
15 2 ▶ my ($s) = @_;
Subroutine as_lf: called CC=1 SCAR=0.0
Pod documented
16 2 $s =~ s#$CRLF#$LF#g;
17 2 return $s;
18 }
19  
20 sub slurp
21 {
22 15 ▶ my ( $fh, $opts ) = @_;
Subroutine slurp: called CC=3 SCAR=11.3
Pod documented
23  
24 15 ▶ if ( $opts->{raw} )
Branch: 1 branch
BranchTrueFalseTotal
if ($opts->{'raw'}) { } 0 15 15
25 {
26 0 return $fh->slurp_raw;
27 }
28 else
29 {
30 15 my $ret = $fh->slurp_utf8;
31 15 ▶ return $opts->{lf} ? as_lf($ret) : $ret;
Branch: 1 branch
BranchTrueFalseTotal
$opts->{'lf'} ? : 1 14 15
32 }
33 }
34  
35 4 1;
36  
37 __END__
« blib/lib/Dir/Manifest.pm ↑ Summary blib/lib/Dir/Manifest/Key.pm »