line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Panda::Lib; |
2
|
11
|
|
|
11
|
|
268196
|
use parent 'Panda::Export'; |
|
11
|
|
|
|
|
2768
|
|
|
11
|
|
|
|
|
48
|
|
3
|
11
|
|
|
11
|
|
67098
|
use 5.012; |
|
11
|
|
|
|
|
27
|
|
4
|
11
|
|
|
11
|
|
4884
|
use Encode(); |
|
11
|
|
|
|
|
89029
|
|
|
11
|
|
|
|
|
1522
|
|
5
|
11
|
|
|
11
|
|
8867
|
use Time::HiRes(); |
|
11
|
|
|
|
|
12543
|
|
|
11
|
|
|
|
|
496
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.3.7'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Panda::Export |
10
|
11
|
|
|
|
|
639
|
MERGE_ARRAY_CONCAT => 1, |
11
|
|
|
|
|
|
|
MERGE_ARRAY_MERGE => 2, |
12
|
|
|
|
|
|
|
MERGE_COPY_DEST => 4, |
13
|
|
|
|
|
|
|
MERGE_LAZY => 8, |
14
|
|
|
|
|
|
|
MERGE_SKIP_UNDEF => 16, |
15
|
|
|
|
|
|
|
MERGE_DELETE_UNDEF => 32, |
16
|
11
|
|
|
11
|
|
1516
|
MERGE_COPY_SOURCE => 64; |
|
11
|
|
|
|
|
28
|
|
17
|
|
|
|
|
|
|
use Panda::Export |
18
|
11
|
|
|
11
|
|
50
|
MERGE_COPY => MERGE_COPY_DEST | MERGE_COPY_SOURCE; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
4408
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
require Panda::XSLoader; |
21
|
|
|
|
|
|
|
Panda::XSLoader::bootstrap(); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
*hash_cmp = *compare; # for compability |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub timeout { |
26
|
2
|
|
|
2
|
0
|
905
|
my ($sub, $timeout) = @_; |
27
|
2
|
50
|
|
|
|
7
|
if (state $in_debugger = defined $DB::header) { $sub->(); return 1 } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
28
|
2
|
|
|
|
|
3
|
my ($ok, $alarm, $error); |
29
|
2
|
|
|
1
|
|
44
|
local $SIG{ALRM} = sub {$alarm = 1; die "ALARM!"}; |
|
1
|
|
|
|
|
100099
|
|
|
1
|
|
|
|
|
17
|
|
30
|
2
|
|
50
|
|
|
21
|
Time::HiRes::alarm($timeout || 1); |
31
|
2
|
|
|
|
|
4
|
eval { |
32
|
2
|
100
|
|
|
|
2
|
eval { $sub->(); 1 } or do { $error = $@ }; |
|
2
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
3
|
|
33
|
2
|
|
|
|
|
17
|
Time::HiRes::alarm(0); |
34
|
|
|
|
|
|
|
}; |
35
|
2
|
100
|
|
|
|
23
|
return if $alarm; |
36
|
1
|
50
|
|
|
|
2
|
die $error if $error; |
37
|
1
|
|
|
|
|
12
|
return 1; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub encode_utf8_struct { |
41
|
3
|
|
|
3
|
0
|
11813
|
my $data = shift; |
42
|
3
|
100
|
|
|
|
8
|
if (ref($data) eq 'HASH') { |
|
|
50
|
|
|
|
|
|
43
|
2
|
|
|
|
|
5
|
foreach my $v (values %$data) { |
44
|
3
|
100
|
|
|
|
23
|
if (ref $v) { encode_utf8_struct($v) } |
|
1
|
50
|
|
|
|
4
|
|
45
|
2
|
|
|
|
|
4
|
elsif (utf8::is_utf8($v)) { $v = Encode::encode_utf8($v) } |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
elsif (ref($data) eq 'ARRAY') { |
49
|
|
|
|
|
|
|
map { |
50
|
1
|
100
|
|
|
|
3
|
if (ref $_) { encode_utf8_struct($_) } |
|
4
|
100
|
|
|
|
19
|
|
|
1
|
|
|
|
|
3
|
|
51
|
1
|
|
|
|
|
2
|
elsif (utf8::is_utf8($_)) { $_ = Encode::encode_utf8($_) } |
52
|
|
|
|
|
|
|
} @$data; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub decode_utf8_struct { |
58
|
3
|
|
|
3
|
0
|
552
|
my $data = shift; |
59
|
3
|
100
|
|
|
|
10
|
if (ref($data) eq 'HASH') { |
|
|
50
|
|
|
|
|
|
60
|
2
|
|
|
|
|
6
|
foreach my $v (values %$data) { |
61
|
3
|
100
|
|
|
|
26
|
if (ref $v) { decode_utf8_struct($v) } |
|
1
|
50
|
|
|
|
4
|
|
62
|
2
|
|
|
|
|
4
|
elsif (!utf8::is_utf8($v)) { $v = Encode::decode_utf8($v) } |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
elsif (ref($data) eq 'ARRAY') { |
66
|
|
|
|
|
|
|
map { |
67
|
1
|
100
|
|
|
|
2
|
if (ref $_) { decode_utf8_struct($_) } |
|
4
|
50
|
|
|
|
52
|
|
|
1
|
|
|
|
|
3
|
|
68
|
3
|
|
|
|
|
6
|
elsif (!utf8::is_utf8($_)) { $_ = Encode::decode_utf8($_) } |
69
|
|
|
|
|
|
|
} @$data; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |