line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
11
|
|
|
11
|
|
50
|
use utf8; |
|
11
|
|
|
|
|
14
|
|
|
11
|
|
|
|
|
45
|
|
2
|
11
|
|
|
11
|
|
230
|
use strict; |
|
11
|
|
|
|
|
13
|
|
|
11
|
|
|
|
|
157
|
|
3
|
11
|
|
|
11
|
|
32
|
use warnings; |
|
11
|
|
|
|
|
12
|
|
|
11
|
|
|
|
|
265
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package DR::Tnt::Msgpack::Types::Int; |
6
|
11
|
|
|
11
|
|
41
|
use Carp; |
|
11
|
|
|
|
|
13
|
|
|
11
|
|
|
|
|
537
|
|
7
|
|
|
|
|
|
|
$Carp::Internal{ (__PACKAGE__) }++; |
8
|
11
|
|
|
11
|
|
48
|
use Scalar::Util (); |
|
11
|
|
|
|
|
14
|
|
|
11
|
|
|
|
|
2765
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
19
|
|
|
19
|
0
|
29
|
my ($class, $v) = @_; |
12
|
19
|
50
|
|
|
|
28
|
if (defined $v) { |
13
|
19
|
50
|
|
|
|
42
|
croak "$v is not looks_like_number" |
14
|
|
|
|
|
|
|
unless Scalar::Util::looks_like_number $v; |
15
|
|
|
|
|
|
|
} |
16
|
19
|
|
33
|
|
|
79
|
bless \$v => ref($class) || $class; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub TO_MSGPACK { |
21
|
16
|
|
|
16
|
0
|
17
|
my ($self) = @_; |
22
|
16
|
|
|
|
|
18
|
my $v = $$self; |
23
|
|
|
|
|
|
|
|
24
|
16
|
50
|
|
|
|
22
|
return pack 'C', 0xC0 unless defined $v; |
25
|
16
|
50
|
|
|
|
20
|
if ($v < 0) { |
26
|
0
|
0
|
|
|
|
0
|
return pack 'c', $v if $v >= -0x1F - 1; |
27
|
0
|
0
|
|
|
|
0
|
return pack 'Cc', 0xD0, $v if $v >= -0x7F - 1; |
28
|
0
|
0
|
|
|
|
0
|
return pack 'Cs>', 0xD1, $v if $v >= -0x7FFF - 1; |
29
|
0
|
0
|
|
|
|
0
|
return pack 'Cl>', 0xD2, $v if $v >= -0x7FFF_FFFF - 1; |
30
|
0
|
|
|
|
|
0
|
return pack 'cq>', 0xD3, $v; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
16
|
100
|
|
|
|
34
|
return pack 'C', $v if $v <= 0x7F; |
34
|
11
|
100
|
|
|
|
26
|
return pack 'Cs>', 0xD1, $v if $v <= 0x7FFF; |
35
|
7
|
100
|
|
|
|
48
|
return pack 'Cl>', 0xD2, $v if $v <= 0x7FFF_FFFF; |
36
|
3
|
|
|
|
|
13
|
return pack 'Cq>', 0xD3, $v; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub TO_JSON { |
40
|
1
|
|
|
1
|
0
|
3
|
my ($self) = @_; |
41
|
1
|
50
|
|
|
|
3
|
return undef unless defined $$self; |
42
|
1
|
|
|
|
|
4
|
return int $$self; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 NAME |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
DR::Tnt::Msgpack::Types::Int - container for integer. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SYNOPSIS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
use DR::Tnt::Msgpack::Types::Int; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $o = DR::Tnt::Msgpack::Types::Int->new(123); |
55
|
|
|
|
|
|
|
my $blob = msgpack($o); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 DESCRIPTION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
See L. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |