File Coverage

blib/lib/MsgPack/Decoder/Generator/Int.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 14 15 93.3


line stmt bran cond sub pod time code
1             package MsgPack::Decoder::Generator::Int;
2             our $AUTHORITY = 'cpan:YANICK';
3             $MsgPack::Decoder::Generator::Int::VERSION = '2.0.2';
4 1     1   586 use Moose;
  1         2  
  1         7  
5 1     1   6672 use MooseX::MungeHas 'is_ro';
  1         2  
  1         7  
6              
7             extends 'MsgPack::Decoder::Generator';
8              
9             has size => ( required => 1,);
10              
11 5     5   191 has '+bytes' => sub { $_[0]->size };
12              
13             my @size_format = qw/ c s x l x x x q /;
14              
15             sub gen_value {
16 5     5 0 11 my $self = shift;
17              
18 5         125 my $format = $size_format[ $self->bytes -1 ] ;
19              
20 5         163 return unpack $format.'*', $self->buffer;
21             };
22              
23             1;
24              
25             __END__
26              
27             =pod
28              
29             =encoding UTF-8
30              
31             =head1 NAME
32              
33             MsgPack::Decoder::Generator::Int
34              
35             =head1 VERSION
36              
37             version 2.0.2
38              
39             =head1 AUTHOR
40              
41             Yanick Champoux <yanick@cpan.org>
42              
43             =head1 COPYRIGHT AND LICENSE
44              
45             This software is copyright (c) 2019, 2017, 2016, 2015 by Yanick Champoux.
46              
47             This is free software; you can redistribute it and/or modify it under
48             the same terms as the Perl 5 programming language system itself.
49              
50             =cut