line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pcore::Util::IDN; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
27
|
use Pcore -export => [qw[domain_to_ascii domain_to_utf8]]; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
29
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
eval { require Net::LibIDN }; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
if ($@) { |
8
|
|
|
|
|
|
|
require Pcore::Util::IDN::PP; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
*domain_to_ascii = \&Pcore::Util::IDN::PP::domain_to_ascii; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
*domain_to_utf8 = \&Pcore::Util::IDN::PP::domain_to_utf8; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
else { |
15
|
|
|
|
|
|
|
*domain_to_ascii = sub { |
16
|
|
|
|
|
|
|
return Net::LibIDN::idn_to_ascii( $_[0], 'utf-8' ) || die q[Can't convert IDN to ASCII]; |
17
|
|
|
|
|
|
|
}; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
*domain_to_utf8 = sub { |
20
|
|
|
|
|
|
|
my $str = Net::LibIDN::idn_to_unicode( $_[0], 'utf-8' ) || die q[Can't convert IDN to UTF-8]; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
utf8::decode($str) or die q[Can't decode to UTF-8]; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
return $str; |
25
|
|
|
|
|
|
|
}; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
## -----SOURCE FILTER LOG BEGIN----- |
30
|
|
|
|
|
|
|
## |
31
|
|
|
|
|
|
|
## PerlCritic profile "pcore-script" policy violations: |
32
|
|
|
|
|
|
|
## +------+----------------------+----------------------------------------------------------------------------------------------------------------+ |
33
|
|
|
|
|
|
|
## | Sev. | Lines | Policy | |
34
|
|
|
|
|
|
|
## |======+======================+================================================================================================================| |
35
|
|
|
|
|
|
|
## | 3 | 5 | ErrorHandling::RequireCheckingReturnValueOfEval - Return value of eval not tested | |
36
|
|
|
|
|
|
|
## +------+----------------------+----------------------------------------------------------------------------------------------------------------+ |
37
|
|
|
|
|
|
|
## |
38
|
|
|
|
|
|
|
## -----SOURCE FILTER LOG END----- |
39
|
|
|
|
|
|
|
__END__ |
40
|
|
|
|
|
|
|
=pod |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=encoding utf8 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Pcore::Util::IDN |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SYNOPSIS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 DESCRIPTION |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 METHODS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 SEE ALSO |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |