lib/Spreadsheet/Reader/ExcelXML/XMLReader/NamedSharedStrings.pm

filter: Statementstmt 85.3% 35 / 41 Branchbran 33.3% 2 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.0% 9 / 10 Podpod 100% 2 / 2 totaltotal 81.3% 48 / 59 CC 4 SCAR 8.5
CC
4
Cov
79%
_should_block_formats
6.0
load_unique_bits
3.5
BEGIN
1.0
CRAP 2.3
« lib/Spreadsheet/Reader/ExcelXML/Types.pm ↑ Summary lib/Spreadsheet/Reader/ExcelXML/XMLReader/WorkbookXML.pm »
1 package Spreadsheet::Reader::ExcelXML::XMLReader::NamedSharedStrings;
2 3 our $AUTHORITY = 'cpan:JANDREW';
3 3 ▶use version; our $VERSION = version->declare('v0.16.8');
Subroutine BEGIN: called CC=1 SCAR=0.0
4 ###LogSD warn "You uncovered internal logging statements for Spreadsheet::Reader::ExcelXML::XMLReader::NamedSharedStrings-$VERSION";
5  
6 3 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 requires qw(
9 set_error close_the_file advance_element_position
10 parse_element get_group_return_type squash_node
11 start_the_file_over current_named_node good_load
12  
13 );
14 3 ▶use Types::Standard qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
15 Int Bool HashRef is_HashRef ArrayRef Enum is_Int
16 3 );
17 3 ▶use Carp qw( confess );
Subroutine BEGIN: called CC=1 SCAR=0.0
18 3 ▶use lib '../../../../../../lib';
Subroutine BEGIN: called CC=1 SCAR=0.0
19 ###LogSD use Log::Shiras::Telephone;
20  
21 #########1 Public Attributes 3#########4#########5#########6#########7#########8#########9
22  
23 3 has cache_positions =>(
24 isa => Bool,
25 reader => 'should_cache_positions',
26 default => 1,
27 );
28  
29 #########1 Public Methods 3#########4#########5#########6#########7#########8#########9
30  
31 1 ▶sub get_shared_string{
Subroutine get_shared_string: called CC=1 SCAR=0.0
Pod documented
32 1 my( $self, $name ) = @_;
33 ###LogSD my $phone = Log::Shiras::Telephone->new( name_space =>
34 ###LogSD $self->get_all_space . '::get_shared_string', );
35 1 confess "Please post an example of this file to: " .
36 "https://github.com/jandrew/p5-spreadsheet-reader-excelxml/issues\n" .
37 "I don't have a good example of this type of file for parsing yet";
38 }
39  
40 4 ▶sub load_unique_bits{
Subroutine load_unique_bits: called CC=3 SCAR=12.5
Pod documented
41 4 my( $self, ) = @_;
42 ###LogSD my $phone = Log::Shiras::Telephone->new( name_space =>
43 ###LogSD $self->get_all_space . '::load_unique_bits', );
44 ###LogSD $phone->talk( level => 'debug', message => [
45 ###LogSD "Setting the sharedStrings unique bits" ] );
46  
47 # Check for empty node and react (Sub element of SharedStrings is SharedString?)
48 4 my( $result, $node_name, $node_level, $result_ref );
49 4 my $current_node = $self->current_node_parsed;
50 ###LogSD $phone->talk( level => 'trace', message =>[
51 ###LogSD "The current node is:", $current_node ] );
52 4 ▶ if( (keys %$current_node)[0] eq 'SharedString' ){
Branch: 1 branch
BranchTrueFalseTotal
if ((keys %$current_node)[0] eq 'SharedString') { } 0 4 4
53 ###LogSD $phone->talk( level => 'trace', message =>[
54 ###LogSD "Found the core properties node" ] );
55 0 $result = 2;
56 0 $node_name = 'cp:coreProperties';
57 }else{
58 4 ( $result, $node_name, $node_level, $result_ref ) =
59 $self->advance_element_position( 'SharedString' );
60 }
61 4 ▶ if( $result ){
Branch: 1 branch
BranchTrueFalseTotal
if ($result) { } 0 4 4
62 ###LogSD $phone->talk( level => 'debug', message => [
63 ###LogSD "The SharedString node has an - Implied 'SharedStrings' node - this is totally incomplete" ] );
64 0 $self->start_the_file_over;
65 0 $self->good_load( 1 );
66 }else{
67 4 $self->set_error( "No 'SharedString' element with content found - can't parse this as a sharedStrings file" );
68 4 return undef;
69 }
70 }
71  
72 #########1 Private Attributes 3#########4#########5#########6#########7#########8#########9
73  
74  
75  
76 #########1 Private Methods 3#########4#########5#########6#########7#########8#########9
77  
78 0 ▶sub _should_block_formats{
Subroutine _should_block_formats: not called CC=2 SCAR=17.9
79 0 my( $self, ) = @_;
80 ###LogSD my $phone = Log::Shiras::Telephone->new( name_space =>
81 ###LogSD $self->get_all_space . '::_should_block_formats', );
82 ###LogSD $phone->talk( level => 'debug', message => [
83 ###LogSD "determining if formats should be blocked: " . $self->get_group_return_type ] );
84 0 ▶ return ( $self->get_group_return_type =~ /(unformatted|value|xml_value)/) ? 1 : 0 ;
Branch: 1 branch
BranchTrueFalseTotal
$self->get_group_return_type =~ /(unformatted|value|xml_value)/ ? : 0 0 0
85 }
86  
87 #########1 Phinish 3#########4#########5#########6#########7#########8#########9
88  
89 3 ▶no Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
90  
91 3 1;
92  
93 #########1 Documentation 3#########4#########5#########6#########7#########8#########9
94 __END__
« lib/Spreadsheet/Reader/ExcelXML/Types.pm ↑ Summary lib/Spreadsheet/Reader/ExcelXML/XMLReader/WorkbookXML.pm »