| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package POE::Component::IRC::Plugin::Unicode::UCD; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
287726
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
32
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
42
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.004'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use base 'POE::Component::IRC::Plugin::BaseWrap'; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
106
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
64
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use Encode qw/decode encode_utf8/; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
67
|
|
|
12
|
1
|
|
|
1
|
|
10
|
use Unicode::UCD 'charinfo'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
541
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _make_default_args { |
|
15
|
|
|
|
|
|
|
return ( |
|
16
|
0
|
|
|
0
|
|
|
response_event => 'irc_unicode_ucd', |
|
17
|
|
|
|
|
|
|
trigger => qr/^utf8?\s+(?=\S)/i, |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _make_response_message { |
|
22
|
0
|
|
|
0
|
|
|
my ( $self, $in_ref ) = @_; |
|
23
|
0
|
|
|
|
|
|
return [ $self->_unip( $in_ref->{what} ) ]; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _make_response_event { |
|
27
|
0
|
|
|
0
|
|
|
my ( $self, $in_ref ) = @_; |
|
28
|
0
|
|
|
|
|
|
$in_ref->{result} = $self->_unip( $in_ref->{what} ); |
|
29
|
0
|
|
|
|
|
|
return $in_ref; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _unip { |
|
33
|
0
|
|
|
0
|
|
|
( my $self, $_ ) = @_; |
|
34
|
|
|
|
|
|
|
|
|
35
|
0
|
0
|
0
|
|
|
|
$_ = "0x$_" |
|
|
|
|
0
|
|
|
|
|
|
36
|
|
|
|
|
|
|
if !s/^[Uu]\+/0x/ |
|
37
|
|
|
|
|
|
|
and /[A-Fa-f]/ |
|
38
|
|
|
|
|
|
|
and /^[[:xdigit:]]{2,}\z/; |
|
39
|
|
|
|
|
|
|
|
|
40
|
0
|
0
|
|
|
|
|
$_ = oct if /^0/; |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
unless ( /^\d+\z/ ) { |
|
43
|
0
|
|
|
|
|
|
eval { |
|
44
|
0
|
0
|
|
|
|
|
my $tmp = decode( |
|
45
|
|
|
|
|
|
|
length > 1 ? 'utf8' : 'iso-8859-1', |
|
46
|
|
|
|
|
|
|
"$_", |
|
47
|
|
|
|
|
|
|
1 |
|
48
|
|
|
|
|
|
|
); |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
die "'$_' is not numeric, conversion to unicode failed" |
|
51
|
|
|
|
|
|
|
unless length ($tmp) == 1; |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
$_ = ord $tmp; |
|
54
|
|
|
|
|
|
|
}; |
|
55
|
0
|
0
|
|
|
|
|
if ( $@ ) { |
|
56
|
0
|
|
|
|
|
|
( my $err = $@ ) =~ s/ at .* line \d+.*\z//s; |
|
57
|
0
|
|
|
|
|
|
return $err; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
} |
|
60
|
0
|
|
|
|
|
|
my $utf8r = encode_utf8( chr ); |
|
61
|
0
|
|
|
|
|
|
my $utf8 = join ' ', map "0x$_", unpack '(H2)*', $utf8r; |
|
62
|
0
|
|
|
|
|
|
my $x; |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
0
|
|
|
|
|
return sprintf "U+%X (%s): no match found", $_, $utf8 |
|
65
|
|
|
|
|
|
|
unless $x = charinfo $_; |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
return "U+$x->{code} ($utf8): $x->{name} [$utf8r]"; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |