| 1 | #ABSTRACT: XML Sitemap Google extension video player entry | ||||||||||||||||||||||||||||
| 2 | 22 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 22 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | package WWW::Sitemap::XML::Google::Video::Player; | ||||||||||||||||||||||||||||
| 5 | 22 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 22 | $WWW::Sitemap::XML::Google::Video::Player::AUTHORITY = 'cpan:AJGB'; | |||||||||||||||||||||||||||
| 7 | } | ||||||||||||||||||||||||||||
| 8 | 22 | $WWW::Sitemap::XML::Google::Video::Player::VERSION = '2.02'; | |||||||||||||||||||||||||||
| 9 | 22 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 22 | ▶ | use WWW::Sitemap::XML::Types qw( Location StrBool ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 22 | has 'loc' => ( | |||||||||||||||||||||||||||
| 15 | is => 'rw', | ||||||||||||||||||||||||||||
| 16 | isa => Location, | ||||||||||||||||||||||||||||
| 17 | required => 1, | ||||||||||||||||||||||||||||
| 18 | coerce => 1, | ||||||||||||||||||||||||||||
| 19 | predicate => 'has_loc', | ||||||||||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 22 | has 'allow_embed' => ( | |||||||||||||||||||||||||||
| 24 | is => 'rw', | ||||||||||||||||||||||||||||
| 25 | isa => StrBool, | ||||||||||||||||||||||||||||
| 26 | required => 0, | ||||||||||||||||||||||||||||
| 27 | coerce => 1, | ||||||||||||||||||||||||||||
| 28 | predicate => 'has_allow_embed', | ||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 22 | has 'autoplay' => ( | |||||||||||||||||||||||||||
| 33 | is => 'rw', | ||||||||||||||||||||||||||||
| 34 | isa => 'Str', | ||||||||||||||||||||||||||||
| 35 | required => 0, | ||||||||||||||||||||||||||||
| 36 | predicate => 'has_autoplay', | ||||||||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 0 | ▶ | sub as_xml { | ||||||||||||||||||||||||||
|
Subroutine
as_xml: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 41 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 0 | my $player = XML::LibXML::Element->new('video:player_loc'); | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | $player->appendText( $self->loc ); | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | do { | ||||||||||||||||||||||||||||
| 48 | 0 | my $name = $_; | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 0 | $player->setAttribute( $name, $self->$name() ); | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | } for grep { | |||||||||||||||||||||||||||
| 53 | 0 | ▶ | eval('$self->has_'.$_) || defined $self->$_() | ||||||||||||||||||||||||||
|
Condition0%0/3
eval '$self->has_' . $_ || defined $self->$_
MC/DC0%0/2
eval '$self->has_' . $_ || defined $self->$_
eval '$self->has_' . $_
defined $self->$_
Truth table0%0/3
A || B
A= eval '$self->has_' . $_B= defined $self->$_
| |||||||||||||||||||||||||||||
| 54 | } qw( allow_embed autoplay ); | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | return $player; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 4 | ▶ | around BUILDARGS => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.8
| |||||||||||||||||||||||||||||
| 60 | 4 | my $next = shift; | |||||||||||||||||||||||||||
| 61 | 4 | my $class = shift; | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 4 | ▶ | if ( @_ == 1 && ! ref $_[0] ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@_ == 1 and not ref $_[0]
MC/DC0%0/2
@_ == 1 and not ref $_[0]
@_ == 1
not ref $_[0]
Truth table66%2/3
A and not(B)
A= @_ == 1B= not ref $_[0]
| |||||||||||||||||||||||||||||
| 64 | 0 | return $class->$next(loc => $_[0]); | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | 4 | return $class->$next( @_ ); | |||||||||||||||||||||||||||
| 67 | 22 | }; | |||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 22 | with 'WWW::Sitemap::XML::Google::Video::Player::Interface'; | |||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 22 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 22 | 1; | |||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | __END__ | ||||||||||||||||||||||||||||