blib/lib/POE/Component/Pastebin/Create.pm

filter: Statementstmt 50.0% 16 / 32 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 55.5% 5 / 9 Podpod 100% 1 / 1 totaltotal 40.7% 22 / 54 CC 6 SCAR 25.0
CC
6
Cov
38%
_prepare_wheel
30.0
_process_request
6.0
_methods_define
2.0
CRAP 12.2
↑ Summary
1 package POE::Component::Pastebin::Create;
2 # ABSTRACT: Non-blocking wrapper to the WWW::Pastebin::*::Create modules
3  
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use POE;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use base 'POE::Component::NonBlockingWrapper::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 0 ▶sub _prepare_wheel {
Subroutine _prepare_wheel: not called CC=5 SCAR=34.0
11 0 my $self = shift;
12  
13 0 ▶ my $type = $self->{pastebin_class} // 'Sprunge';
Condition0%0/2
$self->{"pastebin_class"} // "Sprunge"
l!l
00
MC/DC0%0/1
$self->{"pastebin_class"} // "Sprunge"
$self->{"pastebin_class"}
Truth table0%0/2
A
A= $self->{"pastebin_class"}
Aresult
11
00
14 0 ▶ my $pkg_name = ($type =~ /^\+/) ? substr($type, 1) : "WWW::Pastebin::${type}::Create";
Branch: 1 branch
BranchTrueFalseTotal
$type =~ /^\+/ ? : 0 0 0
15 0 eval "use $pkg_name";
16 0 ▶ croak "Cannot load the module $pkg_name\n" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
17  
18 0 ▶ my $options = $self->{pastebin_args} // {};
Condition0%0/2
$self->{"pastebin_args"} // {}
l!l
00
MC/DC0%0/1
$self->{"pastebin_args"} // {}
$self->{"pastebin_args"}
Truth table0%0/2
A
A= $self->{"pastebin_args"}
Aresult
11
00
19 0 $self->{writer} = $pkg_name->new(%{$options});
20  
21 0 return $self;
22 }
23  
24 0 ▶sub _methods_define {
Subroutine _methods_define: not called CC=1 SCAR=6.9
25 0 return (paste => '_wheel_entry');
26 }
27  
28 0 ▶sub _process_request {
Subroutine _process_request: not called CC=2 SCAR=17.9
29 0 my ($self, $request) = @_;
30  
31 0 ▶ if ($self->{writer}->paste($request->{text}, %{$request})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'writer'}->paste($request->{'text'}, %{$request;})) { } 0 0 0
32 0 $request->{uri} = $self->{writer}->paste_uri;
33 } else {
34 0 $request->{error} = $self->{writer}->error;
35 }
36 }
37  
38 0 ▶sub paste {
Subroutine paste: not called CC=1 SCAR=6.9
Pod documented
39 0 $poe_kernel->post(shift->{session_id} => paste => @_);
40 }
41  
42 1 1;
43  
44  
45 __END__
↑ Summary