ActionPack/AcceptLanguage.pm

filter: Statementstmt 100% 19 / 19 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 93.5% 29 / 31 CC 4 SCAR 9.3
CC
4
Cov
92%
canonicalize_choice
4.1
BEGIN
1.0
BEGIN
1.0
CRAP 2.5
« ActionPack/Authorization/Basic.pm ↑ Summary ActionPack/AcceptCharset.pm »
1 package HTTP::Headers::ActionPack::AcceptLanguage;
2 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 $HTTP::Headers::ActionPack::AcceptLanguage::AUTHORITY = 'cpan:STEVAN';
4 }
5 {
6 1 $HTTP::Headers::ActionPack::AcceptLanguage::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 parent 'HTTP::Headers::ActionPack::PriorityList';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 # We'll just assume that any script or variant names are being given in the
16 # right form. To do this all properly would basically require having all the
17 # ICU data available, which we're not going to attempt currently.
18 65 ▶sub canonicalize_choice {
Subroutine canonicalize_choice: called CC=4 SCAR=14.0
Pod documented
19 65 ▶ return unless defined $_[1];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[1] 0 65 65
20 65 my @parts = split /[-_]/, $_[1];
21  
22 65 my $lang = lc shift @parts;
23  
24 65 ▶ if (@parts) {
Branch: 1 branch
BranchTrueFalseTotal
if (@parts) 20 45 65
25 20 ▶ $parts[-1] = uc $parts[-1]
Branch: 1 branch
BranchTrueFalseTotal
if length $parts[-1] == 2 20 0 20
26 if length $parts[-1] == 2;
27 }
28  
29 65 return join '-', $lang, @parts;
30 }
31  
32 1 1;
33  
34 __END__
« ActionPack/Authorization/Basic.pm ↑ Summary ActionPack/AcceptCharset.pm »