File Coverage

blib/lib/Data/Record/Serialize/Role/EncodeAndSink.pm
Criterion Covered Total %
statement 17 18 94.4
branch n/a
condition n/a
subroutine 6 7 85.7
pod n/a
total 23 25 92.0


line stmt bran cond sub pod time code
1             package Data::Record::Serialize::Role::EncodeAndSink;
2              
3             # ABSTRACT: Both an Encode and Sink. handle unwanted/unused required routines
4              
5 6     6   295336 use v5.12;
  6         62  
6 6     6   43 use strict;
  6         31  
  6         237  
7 6     6   40 use warnings;
  6         40  
  6         684  
8              
9             our $VERSION = '2.02';
10              
11 6     6   554 use Data::Record::Serialize::Error { errors => [qw( internal )] }, -all;
  6         33  
  6         133  
12              
13 6     6   1938 use Moo::Role;
  6         19561  
  6         48  
14              
15 6     6   4294 use namespace::clean;
  6         23912  
  6         77  
16              
17             ## no critic ( Subroutines::ProhibitBuiltinHomonyms )
18             ## no critic(BuiltinFunctions::ProhibitComplexMappings)
19              
20             # These are not used for a combined encoder and sink; if
21             # they are called it's an internal error, so create versions
22             # to catch them.
23              
24             sub say;
25             sub print;
26             sub encode;
27              
28             ( *say, *print, *encode ) = map {
29             my $stub = $_;
30 0     0     sub { error( 'internal', "internal error: stub method <$stub> invoked" ) }
31             } qw( say print encode );
32              
33             with 'Data::Record::Serialize::Role::Sink';
34             with 'Data::Record::Serialize::Role::Encode';
35              
36             1;
37              
38             #
39             # This file is part of Data-Record-Serialize
40             #
41             # This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory.
42             #
43             # This is free software, licensed under:
44             #
45             # The GNU General Public License, Version 3, June 2007
46             #
47              
48             __END__