File Coverage

lib/Spreadsheet/Reader/ExcelXML/WorkbookRelsInterface.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Spreadsheet::Reader::ExcelXML::WorkbookRelsInterface;
2             our $AUTHORITY = 'cpan:JANDREW';
3 17     17   20973 use version; our $VERSION = version->declare('v0.16.8');
  17         31  
  17         112  
4             ###LogSD warn "You uncovered internal logging statements for Spreadsheet::Reader::ExcelXML::WorkbookRelsInterface-$VERSION";
5              
6 17     17   1599 use Moose::Role;
  17         23  
  17         124  
7             requires qw(
8             get_sheet_lookup get_worksheet_list get_chartsheet_list
9             loaded_correctly
10             );
11              
12             ###LogSD requires 'get_log_space', 'get_all_space';
13              
14             #########1 Dispatch Tables 3#########4#########5#########6#########7#########8#########9
15              
16              
17              
18             #########1 Public Attributes 3#########4#########5#########6#########7#########8#########9
19              
20              
21              
22             #########1 Public Methods 3#########4#########5#########6#########7#########8#########9
23              
24             ###LogSD sub get_class_space{ 'WorkbookRelsInterface' }
25              
26             #########1 Private Attributes 3#########4#########5#########6#########7#########8#########9
27              
28              
29              
30             #########1 Private Methods 3#########4#########5#########6#########7#########8#########9
31              
32              
33              
34             #########1 Phinish 3#########4#########5#########6#########7#########8#########9
35              
36 17     17   62255 no Moose::Role;
  17         28  
  17         69  
37             1;
38              
39             #########1 Documentation 3#########4#########5#########6#########7#########8#########9
40             __END__
41              
42             =head1 NAME
43              
44             Spreadsheet::Reader::ExcelXML::WorkbookRelsInterface - Workbook rels file interface
45              
46             =head1 SYNOPSIS
47              
48             #!/usr/bin/env perl
49             use Data::Dumper;
50             use MooseX::ShortCut::BuildInstance qw( build_instance );
51             use Types::Standard qw( HashRef );
52             use Spreadsheet::Reader::ExcelXML::XMLReader;
53             use Spreadsheet::Reader::ExcelXML::ZipReader::WorkbookRels;
54             use Spreadsheet::Reader::ExcelXML::WorkbookRelsInterface;
55             my $test_file = 't/test_files/xl/_rels/workbook.xml.rels';
56             my $workbook_instance = build_instance(
57             package => 'Spreadsheet::Reader::ExcelXML::Workbook',
58             add_attributes =>{
59             _rel_lookup =>{
60             isa => HashRef,
61             traits => ['Hash'],
62             handles =>{ get_rel_info => 'get', },
63             default => sub{ {
64             'rId2' => 'Sheet5',
65             'rId3' => 'Sheet1',
66             'rId1' => 'Sheet2'
67             } },
68             },
69             _sheet_lookup =>{
70             isa => HashRef,
71             traits => ['Hash'],
72             handles =>{ get_sheet_info => 'get', },
73             default => sub{ {
74             'Sheet1' => {
75             'sheet_id' => '1',
76             'sheet_position' => 2,
77             'sheet_name' => 'Sheet1',
78             'is_hidden' => 0,
79             'sheet_rel_id' => 'rId3'
80             },
81             'Sheet2' => {
82             'sheet_position' => 0,
83             'sheet_name' => 'Sheet2',
84             'sheet_id' => '2',
85             'sheet_rel_id' => 'rId1',
86             'is_hidden' => 0
87             },
88             'Sheet5' => {
89             'sheet_position' => 1,
90             'sheet_name' => 'Sheet5',
91             'sheet_id' => '3',
92             'sheet_rel_id' => 'rId2',
93             'is_hidden' => 1
94             }
95             } },
96             },
97             },
98             add_methods =>{
99             get_sheet_names => sub{ [
100             'Sheet2',
101             'Sheet5',
102             'Sheet1'
103             ] },
104             }
105             );
106             my $test_instance = build_instance(
107             package => 'WorkbookRelsInterface',
108             superclasses => ['Spreadsheet::Reader::ExcelXML::XMLReader'],
109             add_roles_in_sequence =>[
110             'Spreadsheet::Reader::ExcelXML::ZipReader::WorkbookRels',
111             'Spreadsheet::Reader::ExcelXML::WorkbookRelsInterface',
112             ],
113             file => $test_file,
114             workbook_inst => $workbook_instance,
115             );
116             print Dumper( $rels_instance->get_worksheet_list );
117              
118             ###########################
119             # SYNOPSIS Screen Output
120             # 01: $VAR1 = [
121             # 01: 'Sheet2',
122             # 01: 'Sheet5',
123             # 01: 'Sheet1'
124             # 01: ]
125             ###########################
126              
127             =head1 DESCRIPTION
128              
129             This documentation is written to explain ways to use this module when writing your own
130             excel parser. To use the general package for excel parsing out of the box please review
131             the documentation for L<Workbooks|Spreadsheet::Reader::ExcelXML>,
132             L<Worksheets|Spreadsheet::Reader::ExcelXML::Worksheet>, and
133             L<Cells|Spreadsheet::Reader::ExcelXML::Cell>
134              
135             This module (role) is provided as a way to standardize access to or L<interface
136             |http://www.cs.utah.edu/~germain/PPS/Topics/interfaces.html> with base rels data files
137             containing workbook level relationships between zip sub file types. It doesn't provide
138             any functionality itself it just provides requirements for any built classes so a consumer
139             of this interface will be able to use a consistent interface. The base class will generally
140             be;
141              
142             L<Spreadsheet::Reader::ExcelXML::XMLReader>
143              
144             The unique functionality is generally provided by;
145              
146             L<Spreadsheet::Reader::ExcelXML::ZipReader::WorkbookRels>
147              
148             L<Spreadsheet::Reader::ExcelXML::XMLReader::WorkbookRels>
149              
150             =head2 Required Methods
151              
152             These are the methods required by the role. A link to the Zip implementation of these
153             methods is provided. The XML versions are documented in ~::XMLReader::WorkbookRels.
154              
155             L<Spreadsheet::Reader::ExcelXML::ZipReader::WorkbookMeta/get_sheet_lookup>
156              
157             L<Spreadsheet::Reader::ExcelXML::ZipReader::WorkbookMeta/get_worksheet_list>
158              
159             L<Spreadsheet::Reader::ExcelXML::ZipReader::WorkbookMeta/get_chartsheet_list>
160              
161             L<Spreadsheet::Reader::ExcelXML::XMLReader/loaded_correctly>
162              
163             =head1 SUPPORT
164              
165             =over
166              
167             L<github Spreadsheet::Reader::ExcelXML/issues
168             |https://github.com/jandrew/p5-spreadsheet-reader-excelxml/issues>
169              
170             =back
171              
172             =head1 TODO
173              
174             =over
175              
176             B<1.> Nothing currently
177              
178             =back
179              
180             =head1 AUTHOR
181              
182             =over
183              
184             =item Jed Lund
185              
186             =item jandrew@cpan.org
187              
188             =back
189              
190             =head1 COPYRIGHT
191              
192             This program is free software; you can redistribute
193             it and/or modify it under the same terms as Perl itself.
194              
195             The full text of the license can be found in the
196             LICENSE file included with this module.
197              
198             This software is copyrighted (c) 2016 by Jed Lund
199              
200             =head1 DEPENDENCIES
201              
202             =over
203              
204             L<Spreadsheet::Reader::ExcelXML> - the package
205              
206             =back
207              
208             =head1 SEE ALSO
209              
210             =over
211              
212             L<Spreadsheet::Read> - generic Spreadsheet reader
213              
214             L<Spreadsheet::ParseExcel> - Excel binary version 2003 and earlier (.xls files)
215              
216             L<Spreadsheet::XLSX> - Excel version 2007 and later
217              
218             L<Spreadsheet::ParseXLSX> - Excel version 2007 and later
219              
220             L<Log::Shiras|https://github.com/jandrew/Log-Shiras>
221              
222             =over
223              
224             All lines in this package that use Log::Shiras are commented out
225              
226             =back
227              
228             =back
229              
230             =cut
231              
232             #########1#########2 main pod documentation end 5#########6#########7#########8#########9