Embed/Util.pm

filter: Statementstmt 79.0% 34 / 43 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.0% 9 / 10 Podpod 100% 3 / 3 totaltotal 76.6% 46 / 60 CC 3 SCAR 13.2
CC
3
Cov
72%
transfer
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.8
« Embed/Reader.pm ↑ Summary
1 package Data::Embed::Util;
2  
3 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 9 ▶use English qw< -no_match_vars >;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 9 ▶use Log::Log4perl::Tiny qw< :easy :dead_if_first >;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 9 our $VERSION = '0.32'; # make indexer happy
9  
10 9 ▶use Exporter qw< import >;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 9 our @EXPORT_OK = qw< STARTER TERMINATOR escape unescape transfer >;
12 9 our @EXPORT = (); # export nothing by default
13 9 our %EXPORT_TAGS = (
14 all => \@EXPORT_OK,
15 escaping => [qw< escape unescape >],
16 constants => [qw< STARTER TERMINATOR >],
17 );
18  
19 9 ▶use constant STARTER => "Data::Embed/index/begin\n";
Subroutine BEGIN: called CC=1 SCAR=0.0
20 9 ▶use constant TERMINATOR => "Data::Embed/index/end\n";
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 121 ▶sub escape {
Subroutine escape: called CC=1 SCAR=0.0
Pod documented
23 121 my $text = shift;
24 121 $text =~ s{([^\w.-])}{'%' . sprintf('%02x', ord $1)}egmxs;
25 121 return $text;
26 }
27  
28 16 ▶sub unescape {
Subroutine unescape: called CC=1 SCAR=0.0
Pod documented
29 16 my $text = shift;
30 16 $text =~ s{%(..)}{chr(hex($1))}egmxs;
31 16 return $text;
32 }
33  
34 0 ▶sub transfer {
Subroutine transfer: not called CC=3 SCAR=24.8
Pod documented
35 0 my ($infh, $outfh) = @_;
36 0 while ('necessary') {
37 0 my $buffer;
38 0 my $n = sysread $infh, $buffer, 0, 4096;
39 0 ▶ LOGCROAK "sysread(): $OS_ERROR" unless defined $n;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $n 0 0 0
40 0 ▶ last unless $n;
Branch: 1 branch
BranchTrueFalseTotal
unless $n 0 0 0
41 0 print {$outfh} $buffer;
42 } ## end while ('necessary')
43 0 return;
44 } ## end sub transfer
45  
46 9 1;
« Embed/Reader.pm ↑ Summary