line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JE; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
1406
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
136
|
|
4
|
3
|
|
|
3
|
|
13
|
use warnings; no warnings 'utf8'; |
|
3
|
|
|
3
|
|
4
|
|
|
3
|
|
|
|
|
93
|
|
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
124
|
|
5
|
3
|
|
|
3
|
|
16
|
use Encode 2.08 qw< decode_utf8 encode_utf8 FB_CROAK >; |
|
3
|
|
|
|
|
7976
|
|
|
3
|
|
|
|
|
2344
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub _decodeURI { |
8
|
25
|
|
|
25
|
|
28
|
my $global = shift; |
9
|
25
|
|
|
|
|
28
|
my $str = shift; |
10
|
25
|
100
|
|
|
|
80
|
$str = defined $str ? $str->to_string->value : 'undefined'; |
11
|
25
|
100
|
|
|
|
249
|
$str =~ /%(?![a-fA-F0-9]{2})(.{0,2})/ |
12
|
|
|
|
|
|
|
and require JE::Object::Error::URIError, |
13
|
|
|
|
|
|
|
die |
14
|
|
|
|
|
|
|
JE::Object::Error::URIError->new( |
15
|
|
|
|
|
|
|
$global, |
16
|
|
|
|
|
|
|
add_line_number |
17
|
|
|
|
|
|
|
"Invalid escape %$1 in URI" |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
18
|
|
|
|
|
54
|
$str = encode_utf8 $str; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# [;/?:@&=+$,#] do not get unescaped |
23
|
18
|
|
|
|
|
138
|
$str =~ s/%(?!2[346bcf]|3[abdf]|40) |
24
|
145
|
|
|
|
|
281
|
([0-9a-f]{2})/chr hex $1/iegx; |
25
|
|
|
|
|
|
|
|
26
|
18
|
100
|
|
|
|
18
|
if (do{ |
27
|
18
|
|
|
|
|
17
|
local $@; |
28
|
18
|
|
|
|
|
26
|
eval { |
29
|
18
|
|
|
|
|
59
|
$str = decode_utf8 $str, FB_CROAK; |
30
|
|
|
|
|
|
|
}; |
31
|
18
|
|
|
|
|
437
|
$@ |
32
|
|
|
|
|
|
|
}) { |
33
|
4
|
|
|
|
|
23
|
require JE'Object'Error'URIError; |
34
|
4
|
|
|
|
|
12
|
die JE::Object::Error::URIError |
35
|
|
|
|
|
|
|
->new( |
36
|
|
|
|
|
|
|
$global, |
37
|
|
|
|
|
|
|
add_line_number |
38
|
|
|
|
|
|
|
'Malformed UTF-8 in URI' |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
$str =~ |
43
|
14
|
100
|
|
|
|
102
|
/^[\0-\x{10ffff}]*\z/ |
44
|
|
|
|
|
|
|
or require JE::Object::Error::URIError, |
45
|
|
|
|
|
|
|
die JE::Object::Error::URIError->new( |
46
|
|
|
|
|
|
|
$global, add_line_number |
47
|
|
|
|
|
|
|
'Malformed UTF-8 in URI'); |
48
|
|
|
|
|
|
|
|
49
|
12
|
|
|
|
|
41
|
JE::String->_new($global, $str); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _decodeURIComponent { |
53
|
25
|
|
|
25
|
|
28
|
my $global = shift; |
54
|
25
|
|
|
|
|
26
|
my $str = shift; |
55
|
25
|
100
|
|
|
|
83
|
$str = defined $str ? $str->to_string->value : 'undefined'; |
56
|
25
|
100
|
|
|
|
208
|
$str =~ /%(?![a-fA-F0-9]{2})(.{0,2})/ |
57
|
|
|
|
|
|
|
and require JE::Object::Error::URIError, |
58
|
|
|
|
|
|
|
die |
59
|
|
|
|
|
|
|
JE::Object::Error::URIError->new( |
60
|
|
|
|
|
|
|
$global, |
61
|
|
|
|
|
|
|
add_line_number |
62
|
|
|
|
|
|
|
"Invalid escape %$1 in URI" |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
18
|
|
|
|
|
52
|
$str = encode_utf8 $str; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# [;/?:@&=+$,#] do not get unescaped |
68
|
18
|
|
|
|
|
131
|
$str =~ s/%([0-9a-f]{2})/chr hex $1/iegx; |
|
156
|
|
|
|
|
271
|
|
69
|
|
|
|
|
|
|
|
70
|
18
|
100
|
|
|
|
20
|
if (do{ |
71
|
18
|
|
|
|
|
16
|
local $@; |
72
|
18
|
|
|
|
|
22
|
eval { |
73
|
18
|
|
|
|
|
58
|
$str = decode_utf8 $str, FB_CROAK; |
74
|
|
|
|
|
|
|
}; |
75
|
18
|
|
|
|
|
377
|
$@ |
76
|
|
|
|
|
|
|
}) { |
77
|
4
|
|
|
|
|
23
|
require JE'Object'Error'URIError; |
78
|
4
|
|
|
|
|
11
|
die JE::Object::Error::URIError |
79
|
|
|
|
|
|
|
->new( |
80
|
|
|
|
|
|
|
$global, |
81
|
|
|
|
|
|
|
add_line_number |
82
|
|
|
|
|
|
|
'Malformed UTF-8 in URI' |
83
|
|
|
|
|
|
|
); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
$str =~ |
87
|
14
|
100
|
|
|
|
89
|
/^[\0-\x{10ffff}]*\z/ |
88
|
|
|
|
|
|
|
or require JE::Object::Error::URIError, |
89
|
|
|
|
|
|
|
die JE::Object::Error::URIError->new( |
90
|
|
|
|
|
|
|
$global, add_line_number |
91
|
|
|
|
|
|
|
'Malformed UTF-8 in URI'); |
92
|
|
|
|
|
|
|
|
93
|
12
|
|
|
|
|
38
|
JE::String->_new($global, $str); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub _encodeURI { |
97
|
12
|
|
|
12
|
|
15
|
my $global = shift; |
98
|
12
|
|
|
|
|
14
|
my $str = shift; |
99
|
12
|
100
|
|
|
|
42
|
$str = defined $str ? $str->to_string->value : 'undefined'; |
100
|
12
|
100
|
|
|
|
95
|
$str =~ /(\p{Cs})/ and |
101
|
|
|
|
|
|
|
require JE::Object::Error::URIError, |
102
|
|
|
|
|
|
|
die JE::Object::Error::URIError->new($global, |
103
|
|
|
|
|
|
|
add_line_number sprintf |
104
|
|
|
|
|
|
|
"Unpaired surrogate 0x%x in string", ord $1 |
105
|
|
|
|
|
|
|
); |
106
|
|
|
|
|
|
|
|
107
|
9
|
|
|
|
|
27
|
$str = encode_utf8 $str; |
108
|
|
|
|
|
|
|
|
109
|
9
|
|
|
|
|
61
|
$str =~ |
110
|
|
|
|
|
|
|
s< ([^;/?:@&=+\$,A-Za-z0-9\-_.!~*'()#]) > |
111
|
58
|
|
|
|
|
124
|
< sprintf '%%%02X', ord $1 >egx; |
112
|
|
|
|
|
|
|
|
113
|
9
|
|
|
|
|
24
|
JE::String->_new($global, $str); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub _encodeURIComponent { |
117
|
12
|
|
|
12
|
|
13
|
my $global = shift; |
118
|
12
|
|
|
|
|
15
|
my $str = shift; |
119
|
12
|
100
|
|
|
|
44
|
$str = defined $str ? $str->to_string->value : 'undefined'; |
120
|
12
|
100
|
|
|
|
176
|
$str =~ /(\p{Cs})/ and |
121
|
|
|
|
|
|
|
require JE::Object::Error::URIError, |
122
|
|
|
|
|
|
|
die JE::Object::Error::URIError->new( |
123
|
|
|
|
|
|
|
$global, add_line_number sprintf |
124
|
|
|
|
|
|
|
"Unpaired surrogate 0x%x in string", ord $1 |
125
|
|
|
|
|
|
|
); |
126
|
|
|
|
|
|
|
|
127
|
9
|
|
|
|
|
28
|
$str = encode_utf8 $str; |
128
|
|
|
|
|
|
|
|
129
|
9
|
|
|
|
|
58
|
$str =~ s< ([^A-Za-z0-9\-_.!~*'()]) > |
130
|
69
|
|
|
|
|
142
|
< sprintf '%%%02X', ord $1 >egx; |
131
|
|
|
|
|
|
|
|
132
|
9
|
|
|
|
|
24
|
JE::String->_new($global, $str); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub _escape { |
136
|
8
|
|
|
8
|
|
9
|
my $global = shift; |
137
|
8
|
100
|
|
|
|
30
|
my $str = defined $_[0] ? shift->to_string->value16 : 'undefined'; |
138
|
3
|
|
|
3
|
|
1454
|
no warnings 'utf8'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
585
|
|
139
|
8
|
|
|
|
|
30
|
$str =~ s< ([^A-Za-z0-9\@*_+\-./]) > |
140
|
193
|
100
|
|
|
|
537
|
[ sprintf '%%' . ( |
141
|
|
|
|
|
|
|
ord $1 <= 0xff |
142
|
|
|
|
|
|
|
? '%02' |
143
|
|
|
|
|
|
|
: 'u%04' |
144
|
|
|
|
|
|
|
) . 'x', ord $1 ]egx; |
145
|
8
|
|
|
|
|
22
|
JE::String->_new($global, $str); |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub _unescape { |
149
|
9
|
|
|
9
|
|
11
|
my $global = shift; |
150
|
9
|
100
|
|
|
|
31
|
my $str = defined $_[0] ? shift->to_string->value16 : 'undefined'; |
151
|
9
|
|
|
|
|
28
|
$str =~s<%(?:u([a-f0-9]{4})|([a-f0-9]{2}))> |
152
|
7
|
|
|
|
|
24
|
< chr hex $+ >egix; |
153
|
9
|
|
|
|
|
21
|
JE::String->_new($global, $str); |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
1 |