File Coverage

blib/lib/MsgPack/Decoder/Generator/Ext.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 15 16 93.7


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