line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
11
|
|
|
11
|
|
76
|
use utf8; |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
59
|
|
2
|
11
|
|
|
11
|
|
360
|
use strict; |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
247
|
|
3
|
11
|
|
|
11
|
|
56
|
use warnings; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
499
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package DR::Tnt::Msgpack::Types; |
6
|
11
|
|
|
11
|
|
66
|
use base 'Exporter'; |
|
11
|
|
|
|
|
27
|
|
|
11
|
|
|
|
|
1272
|
|
7
|
|
|
|
|
|
|
|
8
|
11
|
|
|
11
|
|
4275
|
use DR::Tnt::Msgpack::Types::Int; |
|
11
|
|
|
|
|
29
|
|
|
11
|
|
|
|
|
374
|
|
9
|
11
|
|
|
11
|
|
4175
|
use DR::Tnt::Msgpack::Types::Str; |
|
11
|
|
|
|
|
33
|
|
|
11
|
|
|
|
|
364
|
|
10
|
11
|
|
|
11
|
|
4235
|
use DR::Tnt::Msgpack::Types::Blob; |
|
11
|
|
|
|
|
32
|
|
|
11
|
|
|
|
|
366
|
|
11
|
11
|
|
|
11
|
|
4129
|
use DR::Tnt::Msgpack::Types::Bool; |
|
11
|
|
|
|
|
30
|
|
|
11
|
|
|
|
|
3640
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
14
|
|
|
|
|
|
|
'all' => [ |
15
|
|
|
|
|
|
|
'mp_int', |
16
|
|
|
|
|
|
|
'mp_bool', |
17
|
|
|
|
|
|
|
'mp_string', |
18
|
|
|
|
|
|
|
'mp_blob', |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
'mp_true', |
21
|
|
|
|
|
|
|
'mp_false', |
22
|
|
|
|
|
|
|
] |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our @EXPORT_OK = @{ $EXPORT_TAGS{all} }; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub mp_int($) { |
29
|
19
|
|
|
19
|
1
|
6824
|
DR::Tnt::Msgpack::Types::Int->new($_[0]); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
sub mp_string($) { |
32
|
23
|
|
|
23
|
1
|
5427
|
DR::Tnt::Msgpack::Types::Str->new($_[0]); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
sub mp_blob($) { |
35
|
13
|
|
|
13
|
1
|
76
|
DR::Tnt::Msgpack::Types::Blob->new($_[0]); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub mp_bool($) { |
39
|
4
|
|
|
4
|
1
|
112
|
DR::Tnt::Msgpack::Types::Bool->new($_[0]); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
sub mp_true() { |
42
|
10
|
|
|
10
|
1
|
1628
|
DR::Tnt::Msgpack::Types::Bool->new(1); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
sub mp_false() { |
45
|
8
|
|
|
8
|
1
|
930
|
DR::Tnt::Msgpack::Types::Bool->new(0); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
DR::Tnt::Msgpack::Types - types for msgpack. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 SYNOPSIS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
use DR::Tnt::Msgpack::Types; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# pack as msgpack INT |
57
|
|
|
|
|
|
|
msgpack(mp_int(123)); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# pack number as string |
60
|
|
|
|
|
|
|
msgpack(mp_string(123)); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# bools |
63
|
|
|
|
|
|
|
msgpack(mp_true); |
64
|
|
|
|
|
|
|
msgpack(mp_false); |
65
|
|
|
|
|
|
|
msgpack(mp_bool(1)); |
66
|
|
|
|
|
|
|
msgpack(mp_bool(0)); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# blob |
70
|
|
|
|
|
|
|
msgpack(mp_blob $blob); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 DESCRIPTION |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Perl doesn't differ C<123> and C<'123'>: |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
msgpack(123); |
78
|
|
|
|
|
|
|
msgpack('123'); # the same |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
From time to time You want to pack numbers as strings (for example You |
81
|
|
|
|
|
|
|
use tarantool's STR-index for user's texts, that contain numbers, too). |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
So You can use C constructor for L. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 METHODS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=over |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item mp_int($) |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Create L object. Its method C |
92
|
|
|
|
|
|
|
packs number as msgpack signed integer value. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item mp_string($) |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Create L object. Its method C |
97
|
|
|
|
|
|
|
packs perl scalar as msgpack string. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item mp_blob($) |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Create L object. Its method C |
102
|
|
|
|
|
|
|
packs perl scalar as msgpack bin object. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item mp_bool($) and shortcuts mp_true/mp_false |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Create L object. Its method C |
107
|
|
|
|
|
|
|
package perl scalar as msgpack boolean. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=back |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
1; |