line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MsgPack::Decoder::Generator::Any; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
3
|
|
|
|
|
|
|
$MsgPack::Decoder::Generator::Any::VERSION = '2.0.3'; |
4
|
4
|
|
|
4
|
|
27
|
use Moose; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
23
|
|
5
|
4
|
|
|
4
|
|
24598
|
use MooseX::MungeHas 'is_ro'; |
|
4
|
|
|
|
|
12445
|
|
|
4
|
|
|
|
|
29
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends 'MsgPack::Decoder::Generator'; |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
4825
|
use experimental 'switch', 'signatures'; |
|
4
|
|
|
|
|
9101
|
|
|
4
|
|
|
|
|
24
|
|
10
|
|
|
|
|
|
|
|
11
|
137
|
|
|
137
|
|
4630
|
has '+bytes' => sub { 1 }; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has '+next' => sub { |
14
|
134
|
|
|
134
|
|
2184
|
my $self = shift; |
15
|
134
|
|
|
|
|
356
|
my $byte = $self->buffer_as_int; |
16
|
|
|
|
|
|
|
|
17
|
134
|
|
|
|
|
501
|
given( $byte ) { |
18
|
134
|
|
|
|
|
1418
|
return [ [ 'FixInt', buffer => $self->buffer ] ] |
19
|
|
|
|
|
|
|
when $byte <= 0x7f; |
20
|
|
|
|
|
|
|
|
21
|
82
|
|
|
|
|
512
|
return [ [ 'FixInt', negative => 1, buffer => $self->buffer ] ] |
22
|
|
|
|
|
|
|
when [ 0xe0 ... 0xff ]; |
23
|
|
|
|
|
|
|
|
24
|
80
|
|
|
|
|
806
|
return [ [ 'Str', bytes => $byte - 0xa0 ] ] when [ 0xa0 ... 0xbf ]; |
25
|
67
|
|
|
|
|
260
|
return SizedType( 2**($byte - 0xd9), [ 'Str' ] ) |
26
|
|
|
|
|
|
|
when [ 0xd9 ... 0xdb ]; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# binaries |
29
|
62
|
|
|
|
|
179
|
return SizedType( 2**($byte - 0xc4), [ 'Str' ] ) |
30
|
|
|
|
|
|
|
when [ 0xc4 ... 0xc6 ]; |
31
|
|
|
|
|
|
|
|
32
|
56
|
|
|
|
|
256
|
return [[ 'Boolean', buffer => $self->buffer ]] when [ 0xc2 ... 0xc3 ]; |
33
|
50
|
|
|
|
|
275
|
return [[ 'Nil' ]] when 0xc0 ; |
34
|
|
|
|
|
|
|
|
35
|
44
|
|
|
|
|
192
|
return [ [ 'Float', size => 4 * ( 2**($byte-0xca) ) ] ] when [ 0xca ... 0xcb ]; |
36
|
|
|
|
|
|
|
|
37
|
41
|
|
|
|
|
256
|
return [ [ 'Int', size => 2**($byte-0xd0) ] ] when [ 0xd0 ... 0xd3 ]; |
38
|
36
|
|
|
|
|
202
|
return [ [ 'UInt', size => 2**($byte-0xcc) ] ] when [ 0xcc ... 0xcf ]; |
39
|
|
|
|
|
|
|
|
40
|
32
|
|
|
|
|
652
|
return [[ 'Array', size => $byte - 0x90 ]] when [ 0x90 ... 0x9f ]; |
41
|
15
|
|
|
|
|
36
|
return SizedType( 2 * 2**($byte - 0xdc), 'Array' ) when [ 0xdc ... 0xdd ]; |
42
|
|
|
|
|
|
|
|
43
|
13
|
|
|
|
|
92
|
return [[ 'Array', size => $byte - 0x80, is_map => 1 ]] when [ 0x80 ... 0x8f ]; |
44
|
11
|
|
|
|
|
28
|
return SizedType( 2 * 2**($byte - 0xde), [ 'Array', is_map => 1 ] ) when [ 0xde ... 0xdf ]; |
45
|
|
|
|
|
|
|
|
46
|
9
|
|
|
|
|
25
|
return SizedType( 2**($byte - 0xc7) => [ 'Ext' ] ) |
47
|
|
|
|
|
|
|
when [ 0xc7 ... 0xc9 ]; |
48
|
6
|
|
|
|
|
188
|
return [ [ 'Ext', size => 2**($byte-0xd4)] ] when [ 0xd4 ... 0xd8 ]; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
0
|
default { return [] } |
|
0
|
|
|
|
|
0
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
}; |
53
|
|
|
|
|
|
|
|
54
|
18
|
|
|
18
|
0
|
37
|
sub SizedType ( $size, $next ) { |
|
18
|
|
|
|
|
37
|
|
|
18
|
|
|
|
|
30
|
|
|
18
|
|
|
|
|
26
|
|
55
|
18
|
|
|
|
|
575
|
return [[ 'Size', bytes => $size, next_item => $next ]]; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=pod |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=encoding UTF-8 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 NAME |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
MsgPack::Decoder::Generator::Any |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 VERSION |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
version 2.0.3 |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 AUTHOR |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Yanick Champoux <yanick@cpan.org> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This software is copyright (c) 2019, 2017, 2016, 2015 by Yanick Champoux. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
83
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |