nopaste/Service/fpaste.pm

filter: Statementstmt 29.4% 5 / 17 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 50.0% 1 / 2 Podpod 0.0% 0 / 1 totaltotal 20.6% 6 / 29 CC 5 SCAR 32.3
CC
5
Cov
20%
paste
30.0
BEGIN
1.0
CRAP 25.2
« nopaste/Service/gist.pm ↑ Summary nopaste/Service/mathbin.pm »
1 package Mojolicious::Command::nopaste::Service::fpaste;
2 1 ▶use Mojo::Base 'Mojolicious::Command::nopaste::Service';
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 has description => "Post to fpaste.org\n";
5  
6 0 ▶sub paste {
Subroutine paste: not called CC=5 SCAR=34.0
Pod undocumented
7 0 my $self = shift;
8 0 ▶ my $lang = $self->language || 'text';
Condition0%0/2
$self->language || 'text'
l!l
00
MC/DC0%0/1
$self->language || 'text'
$self->language
Truth table0%0/2
A
A= $self->language
Aresult
11
00
9  
10 0 ▶ my $tx = $self->ua->post(
Branch: 2 branches
BranchTrueFalseTotal
$self->private ? : 0 0 0
$self->name ? : 0 0 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 ▶ unless ($tx->res->is_success) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($tx->res->is_success) 0 0 0
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)};
31  
32 0 return $url;
33 }
34  
35 1 1;
« nopaste/Service/gist.pm ↑ Summary nopaste/Service/mathbin.pm »