| 1 | package Data::Encoder::Data::MessagePack; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | ▶ | use Data::MessagePack; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 1 | my $ooish = $Data::MessagePack::VERSION >= 0.36; | |||||||||||
| 8 | |||||||||||||
| 9 | 2 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||
| 10 | 2 | my ($class, $args) = @_; | |||||||||||
| 11 | 2 | my $mp = 'Data::MessagePack'; | |||||||||||
| 12 | 2 | ▶ | if ($ooish) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 13 | 2 | $mp = Data::MessagePack->new; | |||||||||||
| 14 | 2 | ▶ | $args ||= {}; | ||||||||||
|
Condition100%2/2
$args ||= {}
MC/DC100%1/1
$args ||= {}
$args
Truth table100%2/2
A
A= $args
| |||||||||||||
| 15 | 2 | for my $method (keys %$args) { | |||||||||||
| 16 | 3 | ▶ | $mp->$method(defined $args->{$method} ? $args->{$method} : ()); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 17 | } | ||||||||||||
| 18 | } | ||||||||||||
| 19 | 2 | bless { mp => $mp }, __PACKAGE__; | |||||||||||
| 20 | } | ||||||||||||
| 21 | |||||||||||||
| 22 | 2 | ▶ | sub encode { | ||||||||||
|
Subroutine
encode: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 23 | 2 | my ($self, $stuff, @args) = @_; | |||||||||||
| 24 | 2 | $self->{mp}->pack($stuff); | |||||||||||
| 25 | } | ||||||||||||
| 26 | |||||||||||||
| 27 | 2 | ▶ | sub decode { | ||||||||||
|
Subroutine
decode: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 28 | 2 | my ($self, $stuff, @args) = @_; | |||||||||||
| 29 | 2 | $self->{mp}->unpack($stuff); | |||||||||||
| 30 | } | ||||||||||||
| 31 | |||||||||||||
| 32 | 1 | 1; | |||||||||||
| 33 | __END__ | ||||||||||||