File Coverage

blib/lib/Mojolicious/Command/nopaste/Service/sprunge.pm
Criterion Covered Total %
statement 3 13 23.0
branch 0 4 0.0
condition n/a
subroutine 1 2 50.0
pod 0 1 0.0
total 4 20 20.0


line stmt bran cond sub pod time code
1             package Mojolicious::Command::nopaste::Service::sprunge;
2 1     1   720 use Mojo::Base 'Mojolicious::Command::nopaste::Service';
  1         3  
  1         5  
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_success) {
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