line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::Component::Pastebin::Create; |
2
|
|
|
|
|
|
|
# ABSTRACT: Non-blocking wrapper to the WWW::Pastebin::*::Create modules |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
30941
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
6
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
101
|
|
7
|
1
|
|
|
1
|
|
1037
|
use POE; |
|
1
|
|
|
|
|
60341
|
|
|
1
|
|
|
|
|
8
|
|
8
|
1
|
|
|
1
|
|
115103
|
use base 'POE::Component::NonBlockingWrapper::Base'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
859
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub _prepare_wheel { |
11
|
0
|
|
|
0
|
|
|
my $self = shift; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
0
|
|
|
|
my $type = $self->{pastebin_class} // 'Sprunge'; |
14
|
0
|
0
|
|
|
|
|
my $pkg_name = ($type =~ /^\+/) ? substr($type, 1) : "WWW::Pastebin::${type}::Create"; |
15
|
0
|
|
|
|
|
|
eval "use $pkg_name"; |
16
|
0
|
0
|
|
|
|
|
croak "Cannot load the module $pkg_name\n" if $@; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
0
|
|
|
|
my $options = $self->{pastebin_args} // {}; |
19
|
0
|
|
|
|
|
|
$self->{writer} = $pkg_name->new(%{$options}); |
|
0
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
return $self; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _methods_define { |
25
|
0
|
|
|
0
|
|
|
return (paste => '_wheel_entry'); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _process_request { |
29
|
0
|
|
|
0
|
|
|
my ($self, $request) = @_; |
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
if ($self->{writer}->paste($request->{text}, %{$request})) { |
|
0
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
$request->{uri} = $self->{writer}->paste_uri; |
33
|
|
|
|
|
|
|
} else { |
34
|
0
|
|
|
|
|
|
$request->{error} = $self->{writer}->error; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub paste { |
39
|
0
|
|
|
0
|
1
|
|
$poe_kernel->post(shift->{session_id} => paste => @_); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |