line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Text::Metacpan; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Mojolicious::Plugin::LinkEmbedder::Link::Text::Metacpan - metacpan.org link |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
This class inherit from L. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
640
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link::Text::HTML'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head2 provider_name |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
0
|
1
|
|
sub provider_name {'Metacpan'} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _learn_from_dom { |
24
|
0
|
|
|
0
|
|
|
my ($self, $dom) = @_; |
25
|
|
|
|
|
|
|
|
26
|
0
|
0
|
0
|
|
|
|
if (my $e = $dom->at('.author-pic > a > img') || $dom->at('link[rel="apple-touch-icon"]')) { |
27
|
0
|
|
0
|
|
|
|
my $url = $e->{src} || $e->{href}; |
28
|
0
|
0
|
|
|
|
|
$self->image($url =~ /^https?:/ ? $url : "//metacpan.org$url"); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
$self->SUPER::_learn_from_dom($dom); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Copyright (C) 2014, Jan Henning Thorsen |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
39
|
|
|
|
|
|
|
the terms of the Artistic License version 2.0. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 AUTHOR |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Jan Henning Thorsen - C |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |