line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MsgPack::Type::Ext; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
3
|
|
|
|
|
|
|
$MsgPack::Type::Ext::VERSION = '2.0.2'; |
4
|
4
|
|
|
4
|
|
32
|
use strict; |
|
4
|
|
|
|
|
72
|
|
|
4
|
|
|
|
|
140
|
|
5
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
110
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
20
|
use Moose; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
65
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has "type" => ( |
10
|
|
|
|
|
|
|
isa => 'Int', |
11
|
|
|
|
|
|
|
is => 'ro', |
12
|
|
|
|
|
|
|
required => 1, |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has "data" => ( |
16
|
|
|
|
|
|
|
is => 'ro', |
17
|
|
|
|
|
|
|
required => 1, |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has fix => ( |
21
|
|
|
|
|
|
|
isa => 'Bool', |
22
|
|
|
|
|
|
|
is => 'ro', |
23
|
|
|
|
|
|
|
lazy => 1, |
24
|
|
|
|
|
|
|
default => sub { |
25
|
|
|
|
|
|
|
my $self = shift; |
26
|
|
|
|
|
|
|
length($self->data) < 16; |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has size => ( |
31
|
|
|
|
|
|
|
isa => 'Int', |
32
|
|
|
|
|
|
|
is => 'ro', |
33
|
|
|
|
|
|
|
lazy => 1, |
34
|
|
|
|
|
|
|
default => sub { |
35
|
|
|
|
|
|
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
if ( $self->fix ) { |
38
|
|
|
|
|
|
|
my $size = 0; |
39
|
|
|
|
|
|
|
$size++ while 2**$size < length $self->data; |
40
|
|
|
|
|
|
|
return 2**$size; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
return length $self->data; |
45
|
|
|
|
|
|
|
}, |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub padded_data { |
49
|
10
|
|
|
10
|
0
|
23
|
my $self = shift; |
50
|
|
|
|
|
|
|
|
51
|
10
|
|
|
|
|
262
|
my $size = $self->size; |
52
|
|
|
|
|
|
|
|
53
|
10
|
|
|
|
|
239
|
my $data = $self->data; |
54
|
10
|
|
|
|
|
72
|
return join '', ( chr(0) ) x ($size - length $data), $data; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=pod |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=encoding UTF-8 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 NAME |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
MsgPack::Type::Ext |
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 |