line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JS::AA; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
738
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
|
|
51
|
use Encode qw/ |
6
|
|
|
|
|
|
|
encode_utf8 |
7
|
|
|
|
|
|
|
decode_utf8 |
8
|
1
|
|
|
1
|
|
5
|
/; |
|
1
|
|
|
|
|
2
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use base qw/Exporter/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1275
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT_OK = qw/ |
13
|
|
|
|
|
|
|
aa_encode |
14
|
|
|
|
|
|
|
aa_decode |
15
|
|
|
|
|
|
|
/; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = 0.02; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $aa_array = [ |
20
|
|
|
|
|
|
|
"(c^_^o)", |
21
|
|
|
|
|
|
|
"(゚Θ゚)", |
22
|
|
|
|
|
|
|
"((o^_^o) - (゚Θ゚))", |
23
|
|
|
|
|
|
|
"(o^_^o)", |
24
|
|
|
|
|
|
|
"(゚ー゚)", |
25
|
|
|
|
|
|
|
"((゚ー゚) + (゚Θ゚))", |
26
|
|
|
|
|
|
|
"((o^_^o) +(o^_^o))", |
27
|
|
|
|
|
|
|
"((゚ー゚) + (o^_^o))", |
28
|
|
|
|
|
|
|
"((゚ー゚) + (゚ー゚))", |
29
|
|
|
|
|
|
|
"((゚ー゚) + (゚ー゚) + (゚Θ゚))", |
30
|
|
|
|
|
|
|
"(゚Д゚) .゚ω゚ノ", |
31
|
|
|
|
|
|
|
"(゚Д゚) .゚Θ゚ノ", |
32
|
|
|
|
|
|
|
"(゚Д゚) ['c']", |
33
|
|
|
|
|
|
|
"(゚Д゚) .゚ー゚ノ", |
34
|
|
|
|
|
|
|
"(゚Д゚) .゚Д゚ノ", |
35
|
|
|
|
|
|
|
"(゚Д゚) [゚Θ゚]" |
36
|
|
|
|
|
|
|
]; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
our $aa_hash = { |
39
|
|
|
|
|
|
|
"(c^_^o)" => 0, |
40
|
|
|
|
|
|
|
"(゚Θ゚)" => 1, |
41
|
|
|
|
|
|
|
"((o^_^o) - (゚Θ゚))" => 2, |
42
|
|
|
|
|
|
|
"(o^_^o)" => 3, |
43
|
|
|
|
|
|
|
"(゚ー゚)" => 4, |
44
|
|
|
|
|
|
|
"((゚ー゚) + (゚Θ゚))" => 5, |
45
|
|
|
|
|
|
|
"((o^_^o) +(o^_^o))" => 6, |
46
|
|
|
|
|
|
|
"((゚ー゚) + (o^_^o))" => 7, |
47
|
|
|
|
|
|
|
"((゚ー゚) + (゚ー゚))" => 8, |
48
|
|
|
|
|
|
|
"((゚ー゚) + (゚ー゚) + (゚Θ゚))" => 9, |
49
|
|
|
|
|
|
|
"(゚Д゚) .゚ω゚ノ" => 10, |
50
|
|
|
|
|
|
|
"(゚Д゚) .゚Θ゚ノ" => 11, |
51
|
|
|
|
|
|
|
"(゚Д゚) ['c']" => 12, |
52
|
|
|
|
|
|
|
"(゚Д゚) .゚ー゚ノ" => 13, |
53
|
|
|
|
|
|
|
"(゚Д゚) .゚Д゚ノ" => 14, |
54
|
|
|
|
|
|
|
"(゚Д゚) [゚Θ゚]" => 15 |
55
|
|
|
|
|
|
|
}; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub aa_encode { |
58
|
1
|
|
|
1
|
1
|
605
|
my ($self, $value) = @_; |
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
|
|
3
|
my $encode = $self->_begin; |
61
|
|
|
|
|
|
|
|
62
|
1
|
|
|
|
|
5
|
my @chars = unpack "U*", decode_utf8($value); |
63
|
|
|
|
|
|
|
|
64
|
1
|
|
|
|
|
66
|
for my $char (@chars) { |
65
|
25
|
|
|
|
|
31
|
$encode .= "(゚Д゚)[゚ε゚]+"; |
66
|
|
|
|
|
|
|
|
67
|
25
|
100
|
|
|
|
37
|
if ($char <= 127) { |
68
|
24
|
|
|
|
|
56
|
for (map { $_ - 48 } unpack 'U*', sprintf("%o", $char)) { |
|
65
|
|
|
|
|
143
|
|
69
|
65
|
|
|
|
|
105
|
$encode .= $aa_array->[$_] . "+ "; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} else { |
72
|
1
|
|
|
|
|
3
|
$encode .= "(o゚ー゚o)+ "; |
73
|
|
|
|
|
|
|
|
74
|
1
|
|
|
|
|
3
|
for (map { chr } unpack 'U*', sprintf( "%04x", $char) ) { |
|
4
|
|
|
|
|
8
|
|
75
|
4
|
|
|
|
|
10
|
$encode .= $aa_array->[hex($_)] . "+ "; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
|
|
4
|
$encode .= $self->_end; |
81
|
|
|
|
|
|
|
|
82
|
1
|
|
|
|
|
4
|
return decode_utf8($encode); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub aa_decode { |
86
|
1
|
|
|
1
|
1
|
682
|
my ($self, $value) = @_; |
87
|
|
|
|
|
|
|
|
88
|
1
|
|
|
|
|
4
|
my @data = $self->_split($value); |
89
|
|
|
|
|
|
|
|
90
|
1
|
|
|
|
|
2
|
my $decode = ''; |
91
|
|
|
|
|
|
|
|
92
|
1
|
|
|
|
|
3
|
for my $data (@data) { |
93
|
26
|
|
|
|
|
42
|
my $number; |
94
|
26
|
100
|
|
|
|
46
|
if ($data =~ /\Q(o゚ー゚o)+\E/) { |
95
|
1
|
|
|
|
|
4
|
$data =~ s/\Q(o゚ー゚o)+ \E//; |
96
|
|
|
|
|
|
|
|
97
|
1
|
|
|
|
|
4
|
$number .= sprintf("%x", $aa_hash->{$_}) for $self->_list($data); |
98
|
|
|
|
|
|
|
|
99
|
1
|
50
|
|
|
|
8
|
$decode .= encode_utf8(chr(hex($number))) if $number; |
100
|
|
|
|
|
|
|
} else { |
101
|
25
|
|
|
|
|
40
|
$number .= $aa_hash->{$_} for $self->_list($data); |
102
|
|
|
|
|
|
|
|
103
|
25
|
100
|
|
|
|
70
|
$decode .= chr(oct(int($number))) if $number; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
1
|
|
|
|
|
12
|
return $decode; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub _begin { |
111
|
1
|
|
|
1
|
|
3
|
return "゚ω゚ノ= /`m´)ノ ~┻━┻ //*´∇`*/ ['_']; o=(゚ー゚) =_=3; c=(゚Θ゚) =(゚ー゚)-(゚ー゚); " |
112
|
|
|
|
|
|
|
. "(゚Д゚) =(゚Θ゚)= (o^_^o)/ (o^_^o);" |
113
|
|
|
|
|
|
|
. "(゚Д゚)={゚Θ゚: '_' ,゚ω゚ノ : ((゚ω゚ノ==3) +'_') [゚Θ゚] " |
114
|
|
|
|
|
|
|
. ",゚ー゚ノ :(゚ω゚ノ+ '_')[o^_^o -(゚Θ゚)] " |
115
|
|
|
|
|
|
|
. ",゚Д゚ノ:((゚ー゚==3) +'_')[゚ー゚] }; (゚Д゚) [゚Θ゚] =((゚ω゚ノ==3) +'_') [c^_^o];" |
116
|
|
|
|
|
|
|
. "(゚Д゚) ['c'] = ((゚Д゚)+'_') [ (゚ー゚)+(゚ー゚)-(゚Θ゚) ];" |
117
|
|
|
|
|
|
|
. "(゚Д゚) ['o'] = ((゚Д゚)+'_') [゚Θ゚];" |
118
|
|
|
|
|
|
|
. "(゚o゚)=(゚Д゚) ['c']+(゚Д゚) ['o']+(゚ω゚ノ +'_')[゚Θ゚]+ ((゚ω゚ノ==3) +'_') [゚ー゚] + " |
119
|
|
|
|
|
|
|
. "((゚Д゚) +'_') [(゚ー゚)+(゚ー゚)]+ ((゚ー゚==3) +'_') [゚Θ゚]+" |
120
|
|
|
|
|
|
|
. "((゚ー゚==3) +'_') [(゚ー゚) - (゚Θ゚)]+(゚Д゚) ['c']+" |
121
|
|
|
|
|
|
|
. "((゚Д゚)+'_') [(゚ー゚)+(゚ー゚)]+ (゚Д゚) ['o']+" |
122
|
|
|
|
|
|
|
. "((゚ー゚==3) +'_') [゚Θ゚];(゚Д゚) ['_'] =(o^_^o) [゚o゚] [゚o゚];" |
123
|
|
|
|
|
|
|
. "(゚ε゚)=((゚ー゚==3) +'_') [゚Θ゚]+ (゚Д゚) .゚Д゚ノ+" |
124
|
|
|
|
|
|
|
. "((゚Д゚)+'_') [(゚ー゚) + (゚ー゚)]+((゚ー゚==3) +'_') [o^_^o -゚Θ゚]+" |
125
|
|
|
|
|
|
|
. "((゚ー゚==3) +'_') [゚Θ゚]+ (゚ω゚ノ +'_') [゚Θ゚]; " |
126
|
|
|
|
|
|
|
. "(゚ー゚)+=(゚Θ゚); (゚Д゚)[゚ε゚]='\\\\'; " |
127
|
|
|
|
|
|
|
. "(゚Д゚).゚Θ゚ノ=(゚Д゚+ ゚ー゚)[o^_^o -(゚Θ゚)];" |
128
|
|
|
|
|
|
|
. "(o゚ー゚o)=(゚ω゚ノ +'_')[c^_^o];" |
129
|
|
|
|
|
|
|
. "(゚Д゚) [゚o゚]='\\\"';" |
130
|
|
|
|
|
|
|
. "(゚Д゚) ['_'] ( (゚Д゚) ['_'] (゚ε゚+" |
131
|
|
|
|
|
|
|
. "(゚Д゚)[゚o゚]+ "; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub _end { |
135
|
1
|
|
|
1
|
|
3
|
return "(゚Д゚)[゚o゚]) (゚Θ゚)) ('_');"; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub _split { |
139
|
1
|
|
|
1
|
|
2
|
my ($self, $aa) = @_; |
140
|
|
|
|
|
|
|
|
141
|
1
|
|
|
|
|
25
|
my ($new) = $aa =~ /\Q[゚o゚]+ \E(.*?)\Q(゚Д゚)[゚o゚]) (゚Θ゚)) ('_');\E/; |
142
|
|
|
|
|
|
|
|
143
|
1
|
|
|
|
|
13
|
my @array = split(/\Q(゚Д゚)[゚ε゚]+\E/, $new); |
144
|
|
|
|
|
|
|
|
145
|
1
|
|
|
|
|
6
|
return @array; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub _list { |
149
|
26
|
|
|
26
|
|
38
|
my ($self, $data) = @_; |
150
|
|
|
|
|
|
|
|
151
|
26
|
|
|
|
|
115
|
my (@array) = $data =~ /(\Q(c^_^o)\E|\Q(゚Θ゚)\E|\Q((o^_^o) - (゚Θ゚))\E|\Q(o^_^o)\E|\Q(゚ー゚)\E|\Q((゚ー゚) + (゚Θ゚))\E|\Q((o^_^o) +(o^_^o))\E|\Q((゚ー゚) + (o^_^o))\E|\Q((゚ー゚) + (゚ー゚))\E|\Q((゚ー゚) + (゚ー゚) + (゚Θ゚))\E|\Q(゚Д゚) .゚ω゚ノ\E|\Q(゚Д゚) .゚Θ゚ノ\E|\Q(゚Д゚) ['c']\E|\Q(゚Д゚) .゚ー゚ノ\E|\Q(゚Д゚) .゚Д゚ノ\E|\Q(゚Д゚) [゚Θ゚]\E)/g; |
152
|
|
|
|
|
|
|
|
153
|
26
|
|
|
|
|
91
|
return @array; |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
1; |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=encoding utf8 |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 NAME |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
JS::AA - Encode and Decode AA |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head1 SYNOPSIS |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
use JS::AA qw/ |
167
|
|
|
|
|
|
|
aa_encode |
168
|
|
|
|
|
|
|
aa_decode |
169
|
|
|
|
|
|
|
/; |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
my $aa = aa_encode($js); |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
my $js = aa_decode($aa); |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 DESCRIPTION |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
This module provides methods for encode and decode AA. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 METHODS |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head2 aa_encode |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
my $aa = aa_encode($js); |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Returns the aa. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head2 aa_decode |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
my $js = aa_decode($aa); |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Returns the javascript. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head1 SEE ALSO |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
L |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
L |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head1 AUTHOR |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
Lucas Tiago de Moraes C |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Lucas Tiago de Moraes. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=cut |