blib/lib/XML/NewsML_G2/Role/Writer/News_Item_Picture.pm

filter: Statementstmt 48.4% 16 / 33 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod n/a totaltotal 38.0% 19 / 50 CC 8 SCAR 35.2
CC
8
Cov
36%
__ANON__
56.0
__ANON__
6.0
BEGIN
1.0
CRAP 33.9
« blib/lib/XML/NewsML_G2/Writer/News_Item.pm ↑ Summary blib/lib/XML/NewsML_G2/Writer.pm »
1 package XML::NewsML_G2::Role::Writer::News_Item_Picture;
2  
3 4 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 with 'XML::NewsML_G2::Role::Writer';
7  
8 around '_build_g2_catalog_schemes' => sub {
9 2 ▶ my ( $orig, $self, @args ) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
10 2 my $result = $self->$orig(@args);
11 2 $result->{rnd} = undef;
12 2 $result->{colsp} = undef;
13 2 return $result;
14 4 };
15  
16 before '_create_authors' => sub {
17 0 ▶ my ( $self, $root ) = @_;
Subroutine __ANON__: not called CC=2 SCAR=17.9
18  
19 0 ▶ if ( $self->news_item->photographer ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->news_item->photographer) 0 0 0
20 0 my $c = $self->_create_creator( $self->news_item->photographer );
21 0 $root->appendChild($c);
22 0 $self->scheme_manager->add_qcode( $c, 'crol', 'photographer' );
23 }
24 0 return;
25 4 };
26  
27 after '_create_remote_content' => sub {
28 0 ▶ my ( $self, $root, $picture ) = @_;
Subroutine __ANON__: not called CC=7 SCAR=40.3
29  
30 0 ▶ return unless $picture->isa('XML::NewsML_G2::Picture');
Branch: 1 branch
BranchTrueFalseTotal
unless $picture->isa("XML::NewsML_G2::Picture") 0 0 0
31  
32 0 foreach (qw/width height orientation/) {
33 0 ▶ $root->setAttribute( $_, $picture->$_ ) if defined $picture->$_;
Branch: 1 branch
BranchTrueFalseTotal
if defined $picture->$_ 0 0 0
34 }
35  
36 0 my $rendition =
37 $self->scheme_manager->build_qcode( 'rnd', $picture->rendition );
38 0 ▶ $root->setAttribute( 'rendition', $rendition ) if $rendition;
Branch: 1 branch
BranchTrueFalseTotal
if $rendition 0 0 0
39  
40 0 my $colsp =
41 $self->scheme_manager->build_qcode( 'colsp', $picture->colorspace );
42 0 ▶ $root->setAttribute( 'colourspace', $colsp ) if $colsp;
Branch: 1 branch
BranchTrueFalseTotal
if $colsp 0 0 0
43  
44 0 ▶ if ( my $altId = $picture->altId ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $altId = $picture->altId) 0 0 0
45 0 $root->appendChild(
46 $self->create_element( 'altId', _text => $altId ) );
47 }
48 0 return;
49 4 };
50  
51 4 1;
52 __END__
53  
54 =head1 NAME
55  
56 XML::NewsML_G2::Role::Writer::News_Item_Picture - Role for writing news items of type 'picture'
57  
58 =head1 DESCRIPTION
59  
60 This module serves as a role for all NewsML-G2 writer classes and get automatically applied when the according news item type is written
61  
62 =head1 AUTHOR
63  
64 Christian Eder C<< <christian.eder@apa.at> >>
65  
66 =head1 LICENCE AND COPYRIGHT
67  
68 Copyright (c) 2014, APA-IT. All rights reserved.
69  
70 See L<XML::NewsML_G2> for the license.
« blib/lib/XML/NewsML_G2/Writer/News_Item.pm ↑ Summary blib/lib/XML/NewsML_G2/Writer.pm »