RFC2047/Parser.pm

filter: Statementstmt 100% 17 / 17 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 92.8% 26 / 28 SCAR 16.1
CC
5
Cov
92%
_parse_error
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 5.0
« RFC2047/AddressList.pm ↑ Summary RFC2047.pm »
1 package Email::MIME::RFC2047::Parser;
2 4 $Email::MIME::RFC2047::Parser::VERSION = '0.96';
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 # ABSTRACT: Base class for parsers
7  
8 sub _parse_error {
9 9 ▶ my ($class, $string_ref, $what) = @_;
Subroutine _parse_error: called CC=5 SCAR=16.2
10  
11 9 my $text;
12 9 my $pos = pos($$string_ref);
13 9 ▶ $pos = 0 if !defined($pos);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $pos 1 8 9
14  
15 9 ▶ if ($pos < length($$string_ref)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $$string_ref) { } 6 3 9
16 6 my $char = substr($$string_ref, $pos, 1);
17 6 ▶ $text = defined($what) ?
Branch: 1 branch
BranchTrueFalseTotal
defined $what ? : 6 0 6
18 "invalid $what at character '$char', pos $pos in string" :
19 "unexpected character '$char' at pos $pos in string";
20 }
21 else {
22 3 ▶ $text = defined($what) ?
Branch: 1 branch
BranchTrueFalseTotal
defined $what ? : 3 0 3
23 "incomplete or missing $what at end of string" :
24 "unexpected end of string";
25 }
26  
27 9 die("Parse error in MIME header: $text $$string_ref\n");
28 }
29  
30 4 1;
31  
32 __END__
« RFC2047/AddressList.pm ↑ Summary RFC2047.pm »