File Coverage

blib/lib/Mojolicious/Command/nopaste/Service/mathbin.pm
Criterion Covered Total %
statement 3 12 25.0
branch 0 8 0.0
condition n/a
subroutine 1 2 50.0
pod 0 1 0.0
total 4 23 17.3


line stmt bran cond sub pod time code
1             package Mojolicious::Command::nopaste::Service::mathbin;
2 1     1   764 use Mojo::Base 'Mojolicious::Command::nopaste::Service';
  1         3  
  1         13  
3              
4             has description => "Post to mathb.in\n";
5              
6             sub paste {
7 0     0 0   my $self = shift;
8              
9 0           my $name = $self->name;
10 0           my $title = $self->desc;
11              
12 0 0         my $tx = $self->ua->post( 'http://mathb.in' => form => {
    0          
    0          
13             code => $self->text,
14             ( $name ? ( name => $name ) : () ),
15             secrecy => $self->private ? 'yes' : '',
16             ( $title ? ( title => $title ) : () ),
17             });
18              
19 0 0         unless ($tx->res->is_success) {
20 0           say $tx->res->message;
21 0           say $tx->res->body;
22 0           exit 1;
23             }
24              
25 0           return $tx->req->url;
26             }
27              
28             1;
29