line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::SocialMeta; |
2
|
5
|
|
|
5
|
|
60211
|
use Moo; |
|
5
|
|
|
|
|
46634
|
|
|
5
|
|
|
|
|
20
|
|
3
|
5
|
|
|
5
|
|
8277
|
use List::MoreUtils qw(uniq); |
|
5
|
|
|
|
|
56281
|
|
|
5
|
|
|
|
|
28
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
6294
|
use HTML::SocialMeta::Twitter; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
138
|
|
6
|
5
|
|
|
5
|
|
1947
|
use HTML::SocialMeta::OpenGraph; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
143
|
|
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
31
|
use MooX::LazierAttributes qw/lzy bld coe/; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
16
|
|
9
|
5
|
|
|
5
|
|
612
|
use MooX::ValidateSubs; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
20
|
|
10
|
5
|
|
|
5
|
|
2839
|
use Coerce::Types::Standard qw/HTML Str Object StrToArray/; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
30
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.74006'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our %encode; |
15
|
|
|
|
|
|
|
BEGIN { |
16
|
5
|
|
|
5
|
|
5647
|
%encode = ( q{&} => q{&}, q{"} => q{"}, q{'} => q{'}, q{<} => q{<}, q{>} => q{>} ); |
17
|
5
|
|
|
|
|
1737
|
$encode{regex} = join "|", keys %encode; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
attributes( |
21
|
|
|
|
|
|
|
[qw(card_type card site site_name title description image image_alt url creator operatingSystem |
22
|
|
|
|
|
|
|
app_country app_name app_id app_url player player_height player_width fb_app_id)] => [ HTML->by('encode_entity'), {lzy, coe} ], |
23
|
|
|
|
|
|
|
[qw(twitter opengraph)] => [ Object, { lzy, bld } ], |
24
|
|
|
|
|
|
|
social => [ sub { [qw/twitter opengraph/] } ], |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
validate_subs( |
28
|
|
|
|
|
|
|
create => { |
29
|
|
|
|
|
|
|
params => [ [ Str, 'card_type' ], [ StrToArray->by('\s'), 'social' ] ], # I expect this to be an arrayref |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
required_fields => { |
32
|
|
|
|
|
|
|
params => [ [ Str, 'card_type' ], [ StrToArray->by('\s'), 'social' ] ], |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub create { |
37
|
|
|
|
|
|
|
return join "\n", map { $_[0]->$_->create( $_[1] ) } @{ $_[2] }; # it doesn't coerce my value |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub required_fields { |
41
|
|
|
|
|
|
|
return uniq( |
42
|
|
|
|
|
|
|
map { $_[0]->$_->required_fields( $_[0]->$_->meta_option( $_[1] ) ) } |
43
|
|
|
|
|
|
|
@{ $_[2] } ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _build_twitter { |
47
|
9
|
100
|
|
9
|
|
1672
|
my %args = map { defined $_[0]->$_ ? ( $_ => $_[0]->$_ ) : () } |
|
144
|
|
|
|
|
331
|
|
48
|
|
|
|
|
|
|
qw/card_type site title description image image_alt url creator |
49
|
|
|
|
|
|
|
operatingSystem app_country app_name app_id app_url |
50
|
|
|
|
|
|
|
player player_width player_height/; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
HTML::SocialMeta::Twitter->new( |
53
|
|
|
|
|
|
|
( |
54
|
9
|
100
|
|
|
|
24
|
map { defined $_[0]->$_ ? ( $_ => $_[0]->$_ ) : () } |
|
144
|
|
|
|
|
390
|
|
55
|
|
|
|
|
|
|
qw/card_type site title description image image_alt url creator |
56
|
|
|
|
|
|
|
operatingSystem app_country app_name app_id app_url |
57
|
|
|
|
|
|
|
player player_width player_height/ |
58
|
|
|
|
|
|
|
) |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub _build_opengraph { |
63
|
|
|
|
|
|
|
HTML::SocialMeta::OpenGraph->new( |
64
|
|
|
|
|
|
|
( |
65
|
8
|
100
|
100
|
8
|
|
1464
|
map { defined $_[0]->$_ ? ( $_ => $_[0]->$_ ) : () } |
|
88
|
100
|
|
|
|
342
|
|
|
|
100
|
|
|
|
|
|
66
|
|
|
|
|
|
|
qw/card_type site_name title description image operatingSystem player |
67
|
|
|
|
|
|
|
image_alt player_width player_height fb_app_id/ |
68
|
|
|
|
|
|
|
), |
69
|
|
|
|
|
|
|
( |
70
|
|
|
|
|
|
|
$_[0]->app_url || $_[0]->url |
71
|
|
|
|
|
|
|
? ( url => $_[0]->app_url ? $_[0]->app_url : $_[0]->url ) |
72
|
|
|
|
|
|
|
: () |
73
|
|
|
|
|
|
|
), |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# |
78
|
|
|
|
|
|
|
# The End |
79
|
|
|
|
|
|
|
# |
80
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |