File Coverage

blib/lib/Mojolicious/Plugin/LinkEmbedder/Link/Text/Metacpan.pm
Criterion Covered Total %
statement 3 9 33.3
branch 0 4 0.0
condition 0 6 0.0
subroutine 1 3 33.3
pod 1 1 100.0
total 5 23 21.7


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