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 1     1   626 use v5.12;
  1         4  
6 1     1   5 use Moo::Role;
  1         14  
  1         13  
7              
8             our $VERSION = '1.05';
9              
10 1     1   511 use namespace::clean;
  1         3  
  1         10  
11              
12 3     3   12 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         25  
25 1         1042 $self->say( join( "\t", @{ $self->output_types }{ @{ $self->output_fields } } ) );
  1         76  
  1         26  
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 1     1   581 no warnings 'uninitialized';
  1         9  
  1         125  
38 3         5 join( "\t", @{ $_[0] }{ @{ $self->output_fields } } );
  3         34  
  3         47  
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__
56              
57             =pod
58              
59             =for :stopwords Diab Jerius Smithsonian Astrophysical Observatory
60              
61             =head1 NAME
62              
63             Data::Record::Serialize::Encode::rdb - encoded a record as /rdb
64              
65             =head1 VERSION
66              
67             version 1.05
68              
69             =head1 SYNOPSIS
70              
71             use Data::Record::Serialize;
72              
73             my $s = Data::Record::Serialize->new( encode => 'rdb', ... );
74              
75             $s->send( \%record );
76              
77             =head1 DESCRIPTION
78              
79             B<Data::Record::Serialize::Encode::rdb> encodes a record as
80             L<RDB|http://compbio.soe.ucsc.edu/rdb>.
81              
82             It performs the L<Data::Record::Serialize::Role::Encode> role.
83              
84             =head1 INTERNALS
85              
86             =for Pod::Coverage setup
87              
88             =for Pod::Coverage encode
89              
90             =head1 INTERFACE
91              
92             There are no additional attributes which may be passed to
93             L<Data::Record::Serialize-E<gt>new>|Data::Record::Serialize/new>.
94              
95             =head1 SUPPORT
96              
97             =head2 Bugs
98              
99             Please report any bugs or feature requests to bug-data-record-serialize@rt.cpan.org or through the web interface at: L<https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Record-Serialize>
100              
101             =head2 Source
102              
103             Source is available at
104              
105             https://gitlab.com/djerius/data-record-serialize
106              
107             and may be cloned from
108              
109             https://gitlab.com/djerius/data-record-serialize.git
110              
111             =head1 SEE ALSO
112              
113             Please see those modules/websites for more information related to this module.
114              
115             =over 4
116              
117             =item *
118              
119             L<Data::Record::Serialize|Data::Record::Serialize>
120              
121             =back
122              
123             =head1 AUTHOR
124              
125             Diab Jerius <djerius@cpan.org>
126              
127             =head1 COPYRIGHT AND LICENSE
128              
129             This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory.
130              
131             This is free software, licensed under:
132              
133             The GNU General Public License, Version 3, June 2007
134              
135             =cut