OOXML/PartParser.pm

filter: Statementstmt 95.4% 21 / 22 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 93.9% 31 / 33 CC 3 SCAR 5.8
CC
3
Cov
92%
parse_part
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« OOXML/Document.pm ↑ Summary OOXML/ContentTypes.pm »
1 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Document::OOXML::PartParser;
3 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # ABSTRACT: OOXML document part parser
7  
8 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Document::OOXML::Part::WordprocessingML;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12 2 my %PART_TYPES = (
13 # Defined in ISO/IEC 29500-1, ยง 11.3
14 WordprocessingML => qr{
15 application/vnd\.openxmlformats-officedocument\.wordprocessingml\.
16 (?:
17 comments|
18 settings|
19 endnotes|
20 fontTable|
21 footer|
22 footnotes|
23 glossary|
24 header|
25 document\.main|
26 document\.template|
27 numbering|
28 styles|
29 webSettings
30 )\+xml
31 }x
32 );
33  
34  
35 20 ▶sub parse_part {
Subroutine parse_part: called CC=3 SCAR=11.3
Pod documented
36 20 my $class = shift;
37 20 my %args = @_;
38  
39 20 ▶ if ($args{content_type} =~ $PART_TYPES{WordprocessingML}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"content_type"} =~ /$PART_TYPES{"WordprocessingML"}/x) 20 0 20
40 return Document::OOXML::Part::WordprocessingML->new_from_xml(
41 $args{part_name},
42 $args{contents},
43 20 ▶ $args{is_strict} ? 1 : 0,
Branch: 1 branch
BranchTrueFalseTotal
$args{'is_strict'} ? : 11 9 20
44 );
45 }
46  
47 0 croak("Unknown part of type '$args{content_type}'");
48 }
49  
50 2 __PACKAGE__->meta->make_immutable();
51  
52 __END__
« OOXML/Document.pm ↑ Summary OOXML/ContentTypes.pm »