File Coverage

blib/lib/MsgPack/Decoder/Generator/Float.pm
Criterion Covered Total %
statement 10 10 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 16 17 94.1


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