| 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
| |||||||||||
| 16 | 81 | my @parts = split /[-_]/, $_[1]; | |||||||||
| 17 | |||||||||||
| 18 | 81 | my $lang = lc shift @parts; | |||||||||
| 19 | |||||||||||
| 20 | 81 | ▶ | if (@parts) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 24 | ▶ | $parts[-1] = uc $parts[-1] | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | if length $parts[-1] == 2; | ||||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 81 | return join '-', $lang, @parts; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 1 | 1; | |||||||||
| 29 | |||||||||||
| 30 | __END__ | ||||||||||