| 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 | BEGIN { | ||||||||||||||||||||||||||||
| 6 | 22 | ▶ | $WWW::Sitemap::XML::Google::Video::Player::AUTHORITY = 'cpan:AJGB'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | } | ||||||||||||||||||||||||||||
| 8 | 22 | $WWW::Sitemap::XML::Google::Video::Player::VERSION = '2.01'; | |||||||||||||||||||||||||||
| 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 | sub as_xml { | ||||||||||||||||||||||||||||
| 41 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
as_xml: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 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->$_() | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | } qw( allow_embed autoplay ); | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | return $player; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | around BUILDARGS => sub { | ||||||||||||||||||||||||||||
| 60 | 4 | ▶ | my $next = shift; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.8
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | =pod | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | =head1 NAME | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | WWW::Sitemap::XML::Google::Video::Player - XML Sitemap Google extension video player entry | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | =head1 VERSION | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | version 2.01 | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | my $player => WWW::Sitemap::XML::Google::Video::Player->new( | ||||||||||||||||||||||||||||
| 93 | { | ||||||||||||||||||||||||||||
| 94 | loc => 'http://mywebsite.com/video_player.swf?video=1', | ||||||||||||||||||||||||||||
| 95 | allow_embed => "yes", | ||||||||||||||||||||||||||||
| 96 | autoplay => "ap=1", | ||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | ); | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | XML output: | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | <?xml version="1.0" encoding="UTF-8"?> | ||||||||||||||||||||||||||||
| 103 | <video:player_loc allow_embed="yes" autoplay="ap=1">http://example.com/video_player.swf?video=2</video:player_loc> | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | WWW::Sitemap::XML::Google::Video::Player represents single video player for | ||||||||||||||||||||||||||||
| 108 | video entry in sitemap file. | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | Class implements L<WWW::Sitemap::XML::Google::Video::Player::Interface>. | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | =head1 ATTRIBUTES | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | =head2 loc | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | URL of the player. | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | isa: L<WWW::Sitemap::XML::Types/"Location"> | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | Required. | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | =head2 allow_embed | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | Whether Google can embed the video in search results. Allowed values are | ||||||||||||||||||||||||||||
| 125 | I<yes> or I<no>. The default value is I<yes>. | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | isa: L<WWW::Sitemap::XML::Types/"StrBool"> | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | Optional. | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | =head2 autoplay | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | User-defined string that Google may append (if appropriate) to the flashvars | ||||||||||||||||||||||||||||
| 134 | parameter to enable autoplay of the video. | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | isa: C<Str> | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | Optional. | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | =head1 METHODS | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | =head2 as_xml | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | Returns L<XML::LibXML::Element> object representing the C<E<lt>video:player_locE<gt>> entry. | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | L<WWW::Sitemap::XML::Google::Video> | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | Alex J. G. Burzyński <ajgb@cpan.org> | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | This software is copyright (c) 2014 by Alex J. G. Burzyński <ajgb@cpan.org>. | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 159 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | =cut | ||||||||||||||||||||||||||||