File Coverage

blib/lib/Data/Record/Serialize/Sink/array.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 0 2 0.0
total 20 22 90.9


line stmt bran cond sub pod time code
1              
2             # ABSTRACT: append encoded data to an array.
3              
4              
5             use Moo::Role;
6 2     2   1167  
  2         5  
  2         12  
7             use Data::Record::Serialize::Error { errors => [ '::create' ] }, -all;
8 2     2   793  
  2         5  
  2         35  
9             our $VERSION = '1.03'; # TRIAL
10              
11             use IO::File;
12 2     2   1196  
  2         3759  
  2         223  
13             use namespace::clean;
14 2     2   14  
  2         4  
  2         15  
15              
16              
17              
18              
19              
20              
21              
22              
23              
24              
25             has output => (
26             is => 'ro',
27             clearer => 1,
28             default => sub { [] },
29             );
30              
31              
32              
33              
34              
35              
36              
37              
38             *say = \&print;
39 4     4 0 36  
  4         18  
40             with 'Data::Record::Serialize::Role::Sink';
41       2 0    
42             1;
43              
44             #
45             # This file is part of Data-Record-Serialize
46             #
47             # This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory.
48             #
49             # This is free software, licensed under:
50             #
51             # The GNU General Public License, Version 3, June 2007
52             #
53              
54              
55             =pod
56              
57             =for :stopwords Diab Jerius Smithsonian Astrophysical Observatory
58              
59             =head1 NAME
60              
61             Data::Record::Serialize::Sink::array - append encoded data to an array.
62              
63             =head1 VERSION
64              
65             version 1.03
66              
67             =head1 SYNOPSIS
68              
69             use Data::Record::Serialize;
70              
71             my $s = Data::Record::Serialize->new( sink => 'array', ?(output => \@output), ... );
72              
73             $s->send( \%record );
74              
75             # last encoded record is here
76             $encoded = $s->output->[-1];
77              
78             =head1 DESCRIPTION
79              
80             B<Data::Record::Serialize::Sink::sink> appends encoded data to an array.
81              
82             It performs the L<Data::Record::Serialize::Role::Sink> role.
83              
84             =head1 ATTRIBUTES
85              
86             =head2 output
87              
88             $array = $s->output;
89              
90             The array into which the encoded record is stored. The last record sent is at
91              
92             $s->output->[-1]
93              
94             =for Pod::Coverage print
95             say
96             close
97              
98             =head1 CONSTRUCTOR OPTIONS
99              
100             =over
101              
102             =item output => I<arrayref>
103              
104             Optional. Where to write the data. An arrayref is provided if not specified.
105              
106             =back
107              
108             =head1 SUPPORT
109              
110             =head2 Bugs
111              
112             Please report any bugs or feature requests to bug-data-record-serialize@rt.cpan.org or through the web interface at: https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Record-Serialize
113              
114             =head2 Source
115              
116             Source is available at
117              
118             https://gitlab.com/djerius/data-record-serialize
119              
120             and may be cloned from
121              
122             https://gitlab.com/djerius/data-record-serialize.git
123              
124             =head1 SEE ALSO
125              
126             Please see those modules/websites for more information related to this module.
127              
128             =over 4
129              
130             =item *
131              
132             L<Data::Record::Serialize|Data::Record::Serialize>
133              
134             =back
135              
136             =head1 AUTHOR
137              
138             Diab Jerius <djerius@cpan.org>
139              
140             =head1 COPYRIGHT AND LICENSE
141              
142             This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory.
143              
144             This is free software, licensed under:
145              
146             The GNU General Public License, Version 3, June 2007
147              
148             =cut