line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Command::nopaste::Service::fpaste; |
2
|
1
|
|
|
1
|
|
625
|
use Mojo::Base 'Mojolicious::Command::nopaste::Service'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has description => "Post to fpaste.org\n"; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub paste { |
7
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
8
|
0
|
|
0
|
|
|
|
my $lang = $self->language || 'text'; |
9
|
|
|
|
|
|
|
|
10
|
0
|
0
|
|
|
|
|
my $tx = $self->ua->post( |
|
|
0
|
|
|
|
|
|
11
|
|
|
|
|
|
|
'http://fpaste.org', |
12
|
|
|
|
|
|
|
form => { |
13
|
|
|
|
|
|
|
api_submit => 1, |
14
|
|
|
|
|
|
|
mode => 'json', |
15
|
|
|
|
|
|
|
paste_data => $self->text, |
16
|
|
|
|
|
|
|
paste_lang => $lang, |
17
|
|
|
|
|
|
|
($self->private ? (paste_private => 1) : ()), |
18
|
|
|
|
|
|
|
($self->name ? (paste_user => $self->name) : ()), |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
unless ($tx->res->is_status_class(200)) { |
23
|
0
|
|
|
|
|
|
say $tx->res->message; |
24
|
0
|
|
|
|
|
|
say $tx->res->body; |
25
|
0
|
|
|
|
|
|
exit 1; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $url = Mojo::URL->new('http://fpaste.org/'); |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
push @{$url->path->parts}, @{$tx->res->json->{result}}{qw(id hash)}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
return $url; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |