ActionPack/AcceptCharset.pm

filter: Statementstmt 100% 22 / 22 Branchbran 75.0% 6 / 8 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 95.3% 41 / 43 CC 6 SCAR 9.9
CC
6
Cov
94%
canonicalize_choice
4.1
new_from_string
3.0
BEGIN
1.0
CRAP 2.7
« ActionPack/AcceptLanguage.pm ↑ Summary ActionPack/LinkHeader.pm »
1 package HTTP::Headers::ActionPack::AcceptCharset;
2 # ABSTRACT: A Priority List customized for Media Types
3  
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = '0.10';
8  
9 1 ▶use Encode qw[ find_encoding ];
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use parent 'HTTP::Headers::ActionPack::PriorityList';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 13 ▶sub new_from_string {
Subroutine new_from_string: called CC=3 SCAR=11.0
Pod documented
14 13 my $self = shift->SUPER::new_from_string(@_);
15 # From RFC-2616 sec14.2
16 # If no "*" is present in an Accept-Charset
17 # field, then all character sets not explicitly
18 # mentioned get a quality value of 0, except for
19 # ISO-8859-1, which gets a quality value of 1
20 # if not explicitly mentioned.
21 13 ▶ unless ( defined $self->priority_of('*')
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->priority_of("*") or defined $self->priority_of("ISO-8859-1")) 4 9 13
Condition100%3/3
defined $self->priority_of("*") or defined $self->priority_of("ISO-8859-1")
l!l&&r!l&&!r
274
MC/DC100%2/2
defined $self->priority_of("*") or defined $self->priority_of("ISO-8859-1")
defined $self->priority_of("*") defined $self->priority_of("ISO-8859-1")
Truth table100%3/3
A or B
A= defined $self->priority_of("*")B= defined $self->priority_of("ISO-8859-1")
ABresult
1X1
011
000
22 || defined $self->priority_of('ISO-8859-1') ) {
23  
24 4 $self->add( 1 => 'ISO-8859-1' );
25 }
26  
27 13 return $self;
28 }
29  
30 121 ▶sub canonicalize_choice {
Subroutine canonicalize_choice: called CC=4 SCAR=14.2
Pod documented
31 121 ▶ return unless defined $_[1];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[1] 0 121 121
32 121 ▶ return '*' if $_[1] eq '*';
Branch: 1 branch
BranchTrueFalseTotal
if $_[1] eq "*" 28 93 121
33 93 ▶ my $charset = find_encoding($_[1])
Branch: 1 branch
BranchTrueFalseTotal
my $charset = &find_encoding($_[1]) or return 93 0 93
34 or return;
35 93 return $charset->mime_name;
36 }
37  
38 1 1;
39  
40 __END__
« ActionPack/AcceptLanguage.pm ↑ Summary ActionPack/LinkHeader.pm »