ActionPack/AcceptCharset.pm

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