line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Encoder::Data::MessagePack; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
362
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
5
|
1
|
|
|
1
|
|
6
|
use Data::MessagePack; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
181
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my $ooish = $Data::MessagePack::VERSION >= 0.36; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
2
|
|
|
2
|
0
|
957
|
my ($class, $args) = @_; |
11
|
2
|
|
|
|
|
3
|
my $mp = 'Data::MessagePack'; |
12
|
2
|
50
|
|
|
|
6
|
if ($ooish) { |
13
|
2
|
|
|
|
|
9
|
$mp = Data::MessagePack->new; |
14
|
2
|
|
100
|
|
|
15
|
$args ||= {}; |
15
|
2
|
|
|
|
|
6
|
for my $method (keys %$args) { |
16
|
3
|
50
|
|
|
|
21
|
$mp->$method(defined $args->{$method} ? $args->{$method} : ()); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
} |
19
|
2
|
|
|
|
|
8
|
bless { mp => $mp }, __PACKAGE__; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub encode { |
23
|
2
|
|
|
2
|
0
|
10
|
my ($self, $stuff, @args) = @_; |
24
|
2
|
|
|
|
|
17
|
$self->{mp}->pack($stuff); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub decode { |
28
|
2
|
|
|
2
|
0
|
703
|
my ($self, $stuff, @args) = @_; |
29
|
2
|
|
|
|
|
22
|
$self->{mp}->unpack($stuff); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
__END__ |