File Coverage

blib/lib/Data/Record/Serialize/Encode/rdb.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 0 2 0.0
total 31 33 93.9


line stmt bran cond sub pod time code
1             package Data::Record::Serialize::Encode::rdb;
2              
3             # ABSTRACT: encoded a record as /rdb
4              
5 2     2   322789 use v5.12;
  2         43  
6 2     2   582 use Moo::Role;
  2         19588  
  2         17  
7              
8             our $VERSION = '2.02';
9              
10 2     2   2029 use namespace::clean;
  2         21714  
  2         18  
11              
12 3     3   18 sub _needs_eol { 1 }
13 3     3   28 sub _map_types { { N => 'N', I => 'N', S => 'S' } }
14              
15              
16              
17              
18              
19              
20              
21             sub setup {
22 1     1 0 3 my $self = shift;
23              
24 1         2 $self->say( join( "\t", @{ $self->output_fields } ) );
  1         46  
25 1         222 $self->say( join( "\t", @{ $self->output_types }{ @{ $self->output_fields } } ) );
  1         30  
  1         37  
26             }
27              
28              
29              
30              
31              
32              
33             sub encode {
34 3     3 0 7 my $self = shift;
35              
36             ## no critic (TestingAndDebugging::ProhibitNoWarnings)
37 2     2   1149 no warnings 'uninitialized';
  2         7  
  2         360  
38 3         6 join( "\t", @{ $_[0] }{ @{ $self->output_fields } } );
  3         64  
  3         68  
39             }
40              
41             with 'Data::Record::Serialize::Role::Encode';
42              
43             1;
44              
45             #
46             # This file is part of Data-Record-Serialize
47             #
48             # This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory.
49             #
50             # This is free software, licensed under:
51             #
52             # The GNU General Public License, Version 3, June 2007
53             #
54              
55             __END__