to_countrycode.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 29 CC 2 SCAR 11.5
CC
2
Cov
0%
is_valid
6.0
_codeset
2.0
BEGIN
2.0
CRAP 3.1
1 package CGI::Untaint::to_countrycode;
2 use warnings;
3 use strict;
4 use base 'CGI::Untaint::printable';
5 use Locale::Country();
6
7 sub is_valid {
8 my ( $self ) = @_;
9
10 my $codeset = $self->_codeset;
11
12 # name in, code out
13 if ( my $code = Locale::Country::country2code( $self->value, $codeset ) )
14 {
15 return $self->value( $code );
16 }
17
18 return;
19 }
20
21 sub _codeset { Locale::Constants::LOCALE_CODE_ALPHA_2 }
22
23 1;