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

filter: Statementstmt 45.1% 14 / 31 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod n/a totaltotal 38.6% 17 / 44 CC 8 SCAR 29.7
CC
8
Cov
36%
__ANON__
30.0
_create_icon
20.0
BEGIN
1.0
CRAP 19.4
« blib/lib/XML/NewsML_G2/Writer.pm ↑ Summary blib/lib/XML/NewsML_G2/Role/Writer/News_Item_Audio.pm »
1 package XML::NewsML_G2::Role::Writer::News_Item_Video;
2  
3 2 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 with 'XML::NewsML_G2::Role::Writer';
7  
8 around '_build_g2_catalog_schemes' => sub {
9 1 ▶ my ( $orig, $self, @args ) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
10 1 my $result = $self->$orig(@args);
11 1 $result->{rnd} = undef;
12 1 return $result;
13 2 };
14  
15 after '_create_remote_content' => sub {
16 0 ▶ my ( $self, $root, $video ) = @_;
Subroutine __ANON__: not called CC=5 SCAR=34.0
17  
18 0 foreach (
19 qw/size width height duration videoframerate videoavgbitrate audiosamplerate/
20 ) {
21 0 ▶ $root->setAttribute( $_, $video->$_ ) if defined $video->$_;
Branch: 1 branch
BranchTrueFalseTotal
if defined $video->$_ 0 0 0
22 }
23  
24 0 my $rendition =
25 $self->scheme_manager->build_qcode( 'vidrnd', $video->rendition );
26 0 ▶ $root->setAttribute( 'rendition', $rendition ) if $rendition;
Branch: 1 branch
BranchTrueFalseTotal
if $rendition 0 0 0
27  
28 0 my $audiochannels =
29 $self->scheme_manager->build_qcode( 'adc', $video->audiochannels );
30 0 ▶ $root->setAttribute( 'audiochannels', $audiochannels ) if $audiochannels;
Branch: 1 branch
BranchTrueFalseTotal
if $audiochannels 0 0 0
31 2 };
32  
33 sub _create_icon {
34 0 ▶ my ( $self, $root ) = @_;
Subroutine _create_icon: not called CC=4 SCAR=30.0
35  
36 0 for my $icon ( @{ $self->news_item->icon } ) {
37 0 my $rendition =
38 $self->scheme_manager->build_qcode( 'rnd', $icon->rendition );
39 0 my $icon_element =
40 $self->create_element( 'icon', rendition => $rendition, );
41  
42 0 foreach (qw/href width height/) {
43 0 ▶ next unless $icon->$_;
Branch: 1 branch
BranchTrueFalseTotal
unless $icon->$_ 0 0 0
44 0 $icon_element->setAttribute( $_, $icon->$_ );
45 }
46 0 $root->appendChild($icon_element);
47 }
48 0 return;
49 }
50  
51 2 1;
52 __END__
53  
54 =head1 NAME
55  
56 XML::NewsML_G2::Role::Writer::News_Item_Video - Role for writing news items of type 'video'
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 Stefan Hrdlicka C<< <stefan.hrdlicka@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.pm ↑ Summary blib/lib/XML/NewsML_G2/Role/Writer/News_Item_Audio.pm »