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.2'; |
4
|
4
|
|
|
4
|
|
32
|
use Moose; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
26
|
|
5
|
4
|
|
|
4
|
|
28040
|
use MooseX::MungeHas 'is_ro'; |
|
4
|
|
|
|
|
14163
|
|
|
4
|
|
|
|
|
28
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends 'MsgPack::Decoder::Generator'; |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
5771
|
use experimental 'switch', 'signatures'; |
|
4
|
|
|
|
|
10345
|
|
|
4
|
|
|
|
|
27
|
|
10
|
|
|
|
|
|
|
|
11
|
137
|
|
|
137
|
|
5218
|
has '+bytes' => sub { 1 }; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has '+next' => sub { |
14
|
134
|
|
|
134
|
|
2326
|
my $self = shift; |
15
|
134
|
|
|
|
|
363
|
my $byte = $self->buffer_as_int; |
16
|
|
|
|
|
|
|
|
17
|
134
|
|
|
|
|
517
|
given( $byte ) { |
18
|
134
|
|
|
|
|
1642
|
return [ [ 'FixInt', buffer => $self->buffer ] ] |
19
|
|
|
|
|
|
|
when $byte <= 0x7f; |
20
|
|
|
|
|
|
|
|
21
|
82
|
|
|
|
|
493
|
return [ [ 'FixInt', negative => 1, buffer => $self->buffer ] ] |
22
|
|
|
|
|
|
|
when [ 0xe0 ... 0xff ]; |
23
|
|
|
|
|
|
|
|
24
|
80
|
|
|
|
|
833
|
return [ [ 'Str', bytes => $byte - 0xa0 ] ] when [ 0xa0 ... 0xbf ]; |
25
|
67
|
|
|
|
|
211
|
return SizedType( 2**($byte - 0xd9), [ 'Str' ] ) |
26
|
|
|
|
|
|
|
when [ 0xd9 ... 0xdb ]; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# binaries |
29
|
62
|
|
|
|
|
171
|
return SizedType( 2**($byte - 0xc4), [ 'Str' ] ) |
30
|
|
|
|
|
|
|
when [ 0xc4 ... 0xc6 ]; |
31
|
|
|
|
|
|
|
|
32
|
56
|
|
|
|
|
288
|
return [[ 'Boolean', buffer => $self->buffer ]] when [ 0xc2 ... 0xc3 ]; |
33
|
50
|
|
|
|
|
299
|
return [[ 'Nil' ]] when 0xc0 ; |
34
|
|
|
|
|
|
|
|
35
|
44
|
|
|
|
|
217
|
return [ [ 'Float', size => 4 * ( 2**($byte-0xca) ) ] ] when [ 0xca ... 0xcb ]; |
36
|
|
|
|
|
|
|
|
37
|
41
|
|
|
|
|
267
|
return [ [ 'Int', size => 2**($byte-0xd0) ] ] when [ 0xd0 ... 0xd3 ]; |
38
|
36
|
|
|
|
|
222
|
return [ [ 'UInt', size => 2**($byte-0xcc) ] ] when [ 0xcc ... 0xcf ]; |
39
|
|
|
|
|
|
|
|
40
|
32
|
|
|
|
|
738
|
return [[ 'Array', size => $byte - 0x90 ]] when [ 0x90 ... 0x9f ]; |
41
|
15
|
|
|
|
|
48
|
return SizedType( 2 * 2**($byte - 0xdc), 'Array' ) when [ 0xdc ... 0xdd ]; |
42
|
|
|
|
|
|
|
|
43
|
13
|
|
|
|
|
113
|
return [[ 'Array', size => $byte - 0x80, is_map => 1 ]] when [ 0x80 ... 0x8f ]; |
44
|
11
|
|
|
|
|
35
|
return SizedType( 2 * 2**($byte - 0xde), [ 'Array', is_map => 1 ] ) when [ 0xde ... 0xdf ]; |
45
|
|
|
|
|
|
|
|
46
|
9
|
|
|
|
|
30
|
return SizedType( 2**($byte - 0xc7) => [ 'Ext' ] ) |
47
|
|
|
|
|
|
|
when [ 0xc7 ... 0xc9 ]; |
48
|
6
|
|
|
|
|
236
|
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
|
|
|
|
|
36
|
|
|
18
|
|
|
|
|
28
|
|
|
18
|
|
|
|
|
28
|
|
55
|
18
|
|
|
|
|
690
|
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.2 |
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 |