NewsML_G2/Role/Writer/News_Item_Picture.pm

filter: Statementstmt 100% 33 / 33 Branchbran 66.6% 8 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 92.0% 46 / 50 CC 8 SCAR 15.6
CC
8
Cov
91%
__ANON__
7.1
__ANON__
2.0
BEGIN
1.0
CRAP 4.8
« NewsML_G2/Writer.pm ↑ Summary NewsML_G2/Writer/Substancial_Item.pm »
1 package XML::NewsML_G2::Role::Writer::News_Item_Picture;
2  
3 6 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 6 with 'XML::NewsML_G2::Role::Writer';
7  
8 23 ▶around '_build_g2_catalog_schemes' => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
9 23 my ( $orig, $self, @args ) = @_;
10 23 my $result = $self->$orig(@args);
11 23 $result->{rnd} = undef;
12 23 $result->{colsp} = undef;
13 23 return $result;
14 6 };
15  
16 23 ▶before '_create_authors' => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
17 23 my ( $self, $root ) = @_;
18  
19 23 ▶ if ( $self->news_item->photographer ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->news_item->photographer) 23 0 23
20 23 my $c = $self->_create_creator( $self->news_item->photographer );
21 23 $root->appendChild($c);
22 23 $self->scheme_manager->add_qcode( $c, 'crol', 'photographer' );
23 }
24 23 return;
25 6 };
26  
27 37 ▶after '_create_remote_content' => sub {
Subroutine __ANON__: called CC=7 SCAR=19.7
28 37 my ( $self, $root, $picture ) = @_;
29  
30 37 ▶ return unless $picture->isa('XML::NewsML_G2::Picture');
Branch: 1 branch
BranchTrueFalseTotal
unless $picture->isa("XML::NewsML_G2::Picture") 0 37 37
31  
32 37 foreach (qw/width height orientation/) {
33 111 ▶ $root->setAttribute( $_, $picture->$_ ) if defined $picture->$_;
Branch: 1 branch
BranchTrueFalseTotal
if defined $picture->$_ 93 18 111
34 }
35  
36 37 my $rendition =
37 $self->scheme_manager->build_qcode( 'rnd', $picture->rendition );
38 37 ▶ $root->setAttribute( 'rendition', $rendition ) if $rendition;
Branch: 1 branch
BranchTrueFalseTotal
if $rendition 37 0 37
39  
40 37 my $colsp =
41 $self->scheme_manager->build_qcode( 'colsp', $picture->colorspace );
42 37 ▶ $root->setAttribute( 'colourspace', $colsp ) if $colsp;
Branch: 1 branch
BranchTrueFalseTotal
if $colsp 0 37 37
43  
44 37 ▶ if ( my $altId = $picture->altId ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $altId = $picture->altId) 9 28 37
45 9 $root->appendChild(
46 $self->create_element( 'altId', _text => $altId ) );
47 }
48 37 return;
49 6 };
50  
51 6 1;
52 __END__
« NewsML_G2/Writer.pm ↑ Summary NewsML_G2/Writer/Substancial_Item.pm »