| 1 | package Mojolicious::Command::nopaste::Service::sprunge; | ||||||||||
| 2 | 1 | ▶ | use Mojo::Base 'Mojolicious::Command::nopaste::Service'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 1 | has description => "Post to sprunge.us\n"; | |||||||||
| 5 | |||||||||||
| 6 | 0 | ▶ | sub paste { | ||||||||
|
Subroutine
paste: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 7 | 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 | ▶ | unless ($tx->res->is_success) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | ▶ | if (my $lang = $self->language) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 0 | $url .= "?$lang"; | |||||||||
| 24 | } | ||||||||||
| 25 | 0 | return $url; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 1 | 1; | |||||||||
| 29 | |||||||||||