ActionPack/AcceptLanguage.pm

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