File Coverage

blib/lib/App/Nopaste/Service/PastebinCom.pm
Criterion Covered Total %
statement 15 27 55.5
branch 0 6 0.0
condition n/a
subroutine 5 7 71.4
pod 1 2 50.0
total 21 42 50.0


line stmt bran cond sub pod time code
1 1     1   744 use strict;
  1         3  
  1         22  
2 1     1   4 use warnings;
  1         2  
  1         49  
3             package App::Nopaste::Service::PastebinCom;
4             # ABSTRACT: Service provider for Pastebin - http://pastebin.com/
5              
6             our $VERSION = '1.012';
7              
8 1     1   5 use parent 'App::Nopaste::Service';
  1         1  
  1         5  
9 1     1   46 use Module::Runtime 'use_module';
  1         9  
  1         13  
10 1     1   44 use namespace::clean 0.19;
  1         13  
  1         5  
11              
12             sub available {
13 0     0 0   eval { use_module('WWW::Pastebin::PastebinCom::Create'); 1 }
  0            
  0            
14             }
15              
16             sub run {
17 0     0 1   my $self = shift;
18 0           my %args = @_;
19              
20 0           use_module('WWW::Pastebin::PastebinCom::Create');
21              
22 0 0         $args{poster} = delete $args{nick} if defined $args{nick};
23 0 0         $args{format} = delete $args{lang} if defined $args{lang};
24              
25 0           my $paster = WWW::Pastebin::PastebinCom::Create->new;
26 0           my $ok = $paster->paste(
27             expiry => 'm',
28             %args,
29             );
30              
31 0 0         return (0, $paster->error) unless $ok;
32 0           return (1, $paster->paste_uri);
33             }
34              
35             1;
36              
37             __END__