| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package HTML::SocialMeta; |
|
2
|
5
|
|
|
5
|
|
60493
|
use Moo; |
|
|
5
|
|
|
|
|
48122
|
|
|
|
5
|
|
|
|
|
23
|
|
|
3
|
5
|
|
|
5
|
|
8390
|
use List::MoreUtils qw(uniq); |
|
|
5
|
|
|
|
|
58077
|
|
|
|
5
|
|
|
|
|
31
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
6877
|
use HTML::SocialMeta::Twitter; |
|
|
5
|
|
|
|
|
18
|
|
|
|
5
|
|
|
|
|
167
|
|
|
6
|
5
|
|
|
5
|
|
2319
|
use HTML::SocialMeta::OpenGraph; |
|
|
5
|
|
|
|
|
15
|
|
|
|
5
|
|
|
|
|
181
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
35
|
use MooX::LazierAttributes qw/lzy bld coe/; |
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
21
|
|
|
9
|
5
|
|
|
5
|
|
669
|
use MooX::ValidateSubs; |
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
20
|
|
|
10
|
5
|
|
|
5
|
|
3400
|
use Coerce::Types::Standard qw/HTML Str Object StrToArray/; |
|
|
5
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
38
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.74005'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our %encode; |
|
15
|
|
|
|
|
|
|
BEGIN { |
|
16
|
5
|
|
|
5
|
|
6214
|
%encode = ( q{&} => q{&}, q{"} => q{"}, q{'} => q{'}, q{<} => q{<}, q{>} => q{>} ); |
|
17
|
5
|
|
|
|
|
1967
|
$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
|
|
1734
|
my %args = map { defined $_[0]->$_ ? ( $_ => $_[0]->$_ ) : () } |
|
|
144
|
|
|
|
|
420
|
|
|
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
|
|
|
|
33
|
map { defined $_[0]->$_ ? ( $_ => $_[0]->$_ ) : () } |
|
|
144
|
|
|
|
|
511
|
|
|
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
|
|
1742
|
map { defined $_[0]->$_ ? ( $_ => $_[0]->$_ ) : () } |
|
|
88
|
100
|
|
|
|
434
|
|
|
|
|
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__ |