line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Command::nopaste::Service::sprunge; |
2
|
1
|
|
|
1
|
|
587
|
use Mojo::Base 'Mojolicious::Command::nopaste::Service'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has description => "Post to sprunge.us\n"; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub paste { |
7
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
8
|
|
|
|
|
|
|
|
9
|
0
|
|
|
|
|
|
my $tx = $self->ua->post( |
10
|
|
|
|
|
|
|
'http://sprunge.us', |
11
|
|
|
|
|
|
|
form => { sprunge => $self->text }, |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
0
|
0
|
|
|
|
|
unless ($tx->res->is_status_class(200)) { |
15
|
0
|
|
|
|
|
|
say $tx->res->message; |
16
|
0
|
|
|
|
|
|
say $tx->res->body; |
17
|
0
|
|
|
|
|
|
exit 1; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
chomp( my $url = $tx->res->body ); |
21
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
if (my $lang = $self->language) { |
23
|
0
|
|
|
|
|
|
$url .= "?$lang"; |
24
|
|
|
|
|
|
|
} |
25
|
0
|
|
|
|
|
|
return $url; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|