line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Text::PasteScsysCoUk; |
2
|
1
|
|
|
1
|
|
476
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link::Text'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
3
|
1
|
|
|
1
|
|
147
|
use Mojo::Util (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
212
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
has media_id => sub { |
6
|
|
|
|
|
|
|
shift->url->path =~ m!^/?(\d+)! ? $1 : ''; |
7
|
|
|
|
|
|
|
}; |
8
|
|
|
|
|
|
|
|
9
|
0
|
|
|
0
|
1
|
|
sub provider_name {'scsys.co.uk'} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub learn { |
12
|
0
|
|
|
0
|
1
|
|
my ($self, $c, $cb) = @_; |
13
|
0
|
0
|
|
|
|
|
my $raw_url = $self->raw_url or return $self->SUPER::learn($c, $cb); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$self->ua->get( |
16
|
|
|
|
|
|
|
$raw_url, |
17
|
|
|
|
|
|
|
sub { |
18
|
0
|
|
|
0
|
|
|
my ($ua, $tx) = @_; |
19
|
0
|
0
|
|
|
|
|
$self->{text} = Mojo::Util::xml_escape($tx->res->body) if $tx->success; |
20
|
0
|
|
|
|
|
|
$self->$cb; |
21
|
|
|
|
|
|
|
}, |
22
|
0
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub raw_url { |
26
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
27
|
0
|
0
|
|
|
|
|
my $media_id = $self->media_id or return; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
Mojo::URL->new("http://paste.scsys.co.uk/$media_id?tx=on"); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=encoding utf8 |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Mojolicious::Plugin::LinkEmbedder::Link::Text::PasteScsysCoUk - paste.scsys.co.uk link |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 DESCRIPTION |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
This class inherit from L. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 OUTPUT HTML |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
This is an example output: |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$txt |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 media_id |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$str = $self->media_id; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 provider_name |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 METHODS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 learn |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 raw_url |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 AUTHOR |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Jan Henning Thorsen |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |