line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Pastebin::sprunge; |
2
|
2
|
|
|
2
|
|
292139
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
84
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
74
|
|
4
|
2
|
|
|
2
|
|
26
|
use v5.10.1; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
1833
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: application for pasting to and reading from sprunge.us |
7
|
|
|
|
|
|
|
our $VERSION = '0.012'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
2
|
|
|
2
|
1
|
1611337
|
my $class = shift; |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
|
|
4
|
my $self; |
14
|
2
|
50
|
|
|
|
12
|
if (@ARGV) { # READ |
15
|
0
|
|
|
|
|
0
|
$self->{paste_id} = shift @ARGV; |
16
|
0
|
|
|
|
|
0
|
require WWW::Pastebin::Sprunge::Retrieve; |
17
|
0
|
|
|
|
|
0
|
$self->{reader} = WWW::Pastebin::Sprunge::Retrieve->new(); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
else { # WRITE |
20
|
2
|
|
|
|
|
4409
|
require WWW::Pastebin::Sprunge::Create; |
21
|
2
|
|
|
|
|
205404
|
$self->{writer} = WWW::Pastebin::Sprunge::Create->new(); |
22
|
|
|
|
|
|
|
} |
23
|
2
|
|
|
|
|
9413
|
return bless $self, $class; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub run { |
28
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
29
|
1
|
|
|
|
|
3
|
my $lang = shift; |
30
|
|
|
|
|
|
|
|
31
|
1
|
50
|
|
|
|
8
|
if ($self->{paste_id}) { # READ |
32
|
0
|
0
|
|
|
|
0
|
$self->{reader}->retrieve($self->{paste_id}) |
33
|
|
|
|
|
|
|
or die "Reading paste $self->{paste_id} failed: ", $self->{reader}->error(); |
34
|
0
|
|
|
|
|
0
|
say $self->{reader}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
else { # WRITE |
37
|
1
|
|
|
|
|
2
|
my $text = do { local $/; }; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
31
|
|
38
|
1
|
50
|
|
|
|
6
|
$self->{writer}->paste($text, lang => $lang) |
39
|
|
|
|
|
|
|
or die 'Paste failed: ', $self->{writer}->error(); |
40
|
1
|
|
|
|
|
891136
|
say $self->{writer}; |
41
|
|
|
|
|
|
|
} |
42
|
1
|
|
|
|
|
240
|
return; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |