line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::SocialMeta::Twitter; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
29
|
use Moo; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
24
|
|
4
|
5
|
|
|
5
|
|
1211
|
use Carp; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
352
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
extends 'HTML::SocialMeta::Base'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.74006'; |
9
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
|
1960
|
use MooX::LazierAttributes; |
|
5
|
|
|
|
|
73400
|
|
|
5
|
|
|
|
|
21
|
|
11
|
5
|
|
|
5
|
|
2657
|
use MooX::ValidateSubs; |
|
5
|
|
|
|
|
3211
|
|
|
5
|
|
|
|
|
38
|
|
12
|
5
|
|
|
5
|
|
476362
|
use Types::Standard qw/Str Object ArrayRef HashRef/; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
30
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
attributes( |
15
|
|
|
|
|
|
|
'+meta_attribute' => ['name'], |
16
|
|
|
|
|
|
|
'+meta_namespace' => ['twitter'], |
17
|
|
|
|
|
|
|
'+card_options' => [ |
18
|
|
|
|
|
|
|
sub { |
19
|
|
|
|
|
|
|
{ |
20
|
|
|
|
|
|
|
summary => q(create_summary), |
21
|
|
|
|
|
|
|
featured_image => q(create_summary_large_image), |
22
|
|
|
|
|
|
|
app => q(create_app), |
23
|
|
|
|
|
|
|
player => q(create_player), |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
], |
27
|
|
|
|
|
|
|
'+build_fields' => [ |
28
|
|
|
|
|
|
|
sub { |
29
|
|
|
|
|
|
|
{ |
30
|
|
|
|
|
|
|
summary => [qw(card site title description image image_alt)], |
31
|
|
|
|
|
|
|
summary_large_image => [qw(card site title description image image_alt)], |
32
|
|
|
|
|
|
|
app => [ |
33
|
|
|
|
|
|
|
qw(card site description app_country app_name app_id app_url) |
34
|
|
|
|
|
|
|
], |
35
|
|
|
|
|
|
|
player => [ |
36
|
|
|
|
|
|
|
qw(card site title description image image_alt player player_width player_height) |
37
|
|
|
|
|
|
|
], |
38
|
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
], |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
validate_subs( |
44
|
|
|
|
|
|
|
create_summary => { |
45
|
|
|
|
|
|
|
params => [ [ Str, sub { 'summary' } ] ], |
46
|
|
|
|
|
|
|
}, |
47
|
|
|
|
|
|
|
create_summary_large_image => { |
48
|
|
|
|
|
|
|
params => [ [ Str, sub { 'summary_large_image' } ] ], |
49
|
|
|
|
|
|
|
}, |
50
|
|
|
|
|
|
|
create_app => { |
51
|
|
|
|
|
|
|
params => [ [ Str, sub { 'app' } ] ], |
52
|
|
|
|
|
|
|
}, |
53
|
|
|
|
|
|
|
create_player => { |
54
|
|
|
|
|
|
|
params => [ [ Str, sub { 'player' } ] ], |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
provider_convert => { |
57
|
|
|
|
|
|
|
params => [ [Str] ], |
58
|
|
|
|
|
|
|
}, |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub create_summary { |
62
|
|
|
|
|
|
|
return $_[0]->build_meta_tags( $_[0]->card( $_[1] ) ); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub create_summary_large_image { |
66
|
|
|
|
|
|
|
return $_[0]->build_meta_tags( $_[0]->card( $_[1] ) ); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub create_app { |
70
|
|
|
|
|
|
|
return $_[0]->build_meta_tags( $_[0]->card( $_[1] ) ); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub create_player { |
74
|
|
|
|
|
|
|
return $_[0]->build_meta_tags( $_[0]->card( $_[1] ) ); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub provider_convert { |
78
|
|
|
|
|
|
|
$_[1] !~ m{^app}xms || $_[1] =~ m&country$&xms |
79
|
|
|
|
|
|
|
and return [ { field_type => $_[1] } ]; |
80
|
|
|
|
|
|
|
$_[0]->operatingSystem eq q#ANDROID# |
81
|
|
|
|
|
|
|
and return [ { field_type => $_[1] . ':googleplay' } ]; |
82
|
|
|
|
|
|
|
$_[0]->operatingSystem eq q~IOS~ |
83
|
|
|
|
|
|
|
and return [ |
84
|
|
|
|
|
|
|
{ field_type => $_[1] . ':iphone' }, |
85
|
|
|
|
|
|
|
{ field_type => $_[1] . ':ipad' } |
86
|
|
|
|
|
|
|
]; |
87
|
|
|
|
|
|
|
return croak 'We currently do not support this APP type'; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# |
91
|
|
|
|
|
|
|
# The End |
92
|
|
|
|
|
|
|
# |
93
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |