| 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"
MC/DC0%0/1
$self->{"pastebin_class"} // "Sprunge"
$self->{"pastebin_class"}
Truth table0%0/2
A
A= $self->{"pastebin_class"}
| |||||||||||||
| 14 | 0 | ▶ | my $pkg_name = ($type =~ /^\+/) ? substr($type, 1) : "WWW::Pastebin::${type}::Create"; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 15 | 0 | eval "use $pkg_name"; | |||||||||||
| 16 | 0 | ▶ | croak "Cannot load the module $pkg_name\n" if $@; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 17 | |||||||||||||
| 18 | 0 | ▶ | my $options = $self->{pastebin_args} // {}; | ||||||||||
|
Condition0%0/2
$self->{"pastebin_args"} // {}
MC/DC0%0/1
$self->{"pastebin_args"} // {}
$self->{"pastebin_args"}
Truth table0%0/2
A
A= $self->{"pastebin_args"}
| |||||||||||||
| 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
| |||||||||||||
| 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__ | ||||||||||||