blib/lib/XML/NewsML_G2/Writer_2_9.pm

filter: Statementstmt 81.4% 22 / 27 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod n/a totaltotal 78.3% 29 / 37 CC 5 SCAR 13.2
CC
5
Cov
79%
__ANON__
6.0
__ANON__
4.0
BEGIN
1.0
CRAP 3.8
« Build ↑ Summary blib/lib/XML/NewsML_G2/Scheme.pm »
1 package XML::NewsML_G2::Writer_2_9;
2  
3 # $Id: Writer_2_9.pm 46997 2013-06-28 13:25:06Z apatecgortan $
4  
5 10 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 10 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8  
9 10 extends 'XML::NewsML_G2::Writer';
10  
11 10 has '+g2_version', default => '2.9';
12 10 has '+schema_location', default => 'http://iptc.org/std/nar/2006-10-01/ http://www.iptc.org/std/NewsML-G2/2.9/specification/NewsML-G2_2.9-spec-All-Power.xsd';
13 10 has '+g2_catalog_url', default => 'http://www.iptc.org/std/catalog/catalog.IPTC-G2-Standards_18.xml';
14  
15 override '_create_catalogs' => sub {
16 1 ▶ my ($self, $root) = @_;
Subroutine __ANON__: called CC=4 SCAR=13.9
17 1 $root->appendChild($self->create_element('catalogRef', href => $self->g2_catalog_url));
18  
19 1 my $cat;
20 1 foreach my $scheme ($self->scheme_manager->get_all_schemes()) {
21 18 ▶ if ($scheme->uri) {
Branch: 1 branch
BranchTrueFalseTotal
if ($scheme->uri) 9 9 18
22 9 ▶ $root->appendChild($cat = $self->create_element('catalog')) unless $cat;
Branch: 1 branch
BranchTrueFalseTotal
unless $cat 1 8 9
23 9 $cat->appendChild($self->create_element('scheme', alias => $scheme->alias, uri => $scheme->uri));
24 }
25 }
26 1 return;
27 10 };
28  
29 override '_create_hierarchy' => sub {
30 0 ▶ my ($self, $node, $schema) = @_;
Subroutine __ANON__: not called CC=2 SCAR=17.9
31 0 my @res;
32  
33 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$node = $node->parent and do { do { unshift @res, "${schema}:" . $node->qcode } } 0 0 0
34 0 unshift @res, "$schema:" . $node->qcode();
35 } while ($node = $node->parent());
36  
37 0 return $self->create_element('hierarchyInfo', _text => join ' ', @res);
38 10 };
39  
40  
41 10 __PACKAGE__->meta->make_immutable;
42  
43 10 1;
44 __END__
45  
46 =head1 NAME
47  
48 XML::NewsML_G2::Writer_2_9 - create XML DOM tree conforming to version
49 2.9 of the NewsML-G2 specification
50  
51 Check the documentation of L<XML::NewsML_G2::Writer> for general
52 information on this class.
53  
54 =head1 AUTHOR
55  
56 Philipp Gortan C<< <philipp.gortan@apa.at> >>
57  
58 =head1 LICENCE AND COPYRIGHT
59  
60 Copyright (c) 2013, APA-IT. All rights reserved.
61  
62 See L<XML::NewsML_G2> for the license.
« Build ↑ Summary blib/lib/XML/NewsML_G2/Scheme.pm »