File Coverage

blib/lib/CBOR/Free/Decoder/Base.pm
Criterion Covered Total %
statement 14 14 100.0
branch 6 6 100.0
condition 3 3 100.0
subroutine 3 3 100.0
pod 0 1 0.0
total 26 27 96.3


line stmt bran cond sub pod time code
1             package CBOR::Free::Decoder::Base;
2              
3 7     7   3723 use strict;
  7         17  
  7         339  
4 7     7   83 use warnings;
  7         23  
  7         26077  
5              
6             sub set_tag_handlers {
7 106     106 0 332481 my ($self, @tag_kv) = @_;
8              
9 106 100       404 die "Uneven tag handlers list given!" if @tag_kv % 2;
10              
11 105         242 my @tag_kv_copy = @tag_kv;
12              
13 105         419 while ( my ($tag, $cr) = splice @tag_kv ) {
14 105 100       751 die "Invalid tag: $tag" if $tag !~ m<\A[0-9]+\z>;
15 104 100 100     893 die "Invalid tag $tag handler: $cr" if defined($cr) && !UNIVERSAL::isa($cr, 'CODE');
16             }
17              
18 103         570 $self->_set_tag_handlers_backend(@tag_kv_copy);
19              
20 103         379 return $self;
21             }
22              
23             1;