| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::Nopaste::Service::dpaste; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
21362
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
34
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
28
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
1264
|
use JSON (); |
|
|
1
|
|
|
|
|
16880
|
|
|
|
1
|
|
|
|
|
58
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $SYNTAX_CHOICES_URL = 'http://dpaste.com/api/v2/syntax-choices/'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
10
|
use base 'App::Nopaste::Service'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
937
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
0
|
|
|
0
|
1
|
|
sub uri { 'http://dpaste.com/' } |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub fill_form { |
|
17
|
0
|
|
|
0
|
1
|
|
my ($self, $mech, %args) = @_; |
|
18
|
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my $syntax_map = $self->get_syntax_map($mech); |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
my $syntax = $syntax_map->{$args{lang}} |
|
22
|
|
|
|
|
|
|
? $syntax_map->{$args{lang}} |
|
23
|
|
|
|
|
|
|
: $syntax_map->{text}; |
|
24
|
|
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
$mech->submit_form( |
|
|
|
0
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
form_name => 'pasteform', |
|
27
|
|
|
|
|
|
|
fields => { |
|
28
|
|
|
|
|
|
|
content => $args{text}, |
|
29
|
|
|
|
|
|
|
syntax => $syntax, |
|
30
|
|
|
|
|
|
|
expiry_days => 1, |
|
31
|
|
|
|
|
|
|
( $args{nick} |
|
32
|
|
|
|
|
|
|
? (poster => $args{nick}) |
|
33
|
|
|
|
|
|
|
: () |
|
34
|
|
|
|
|
|
|
), |
|
35
|
|
|
|
|
|
|
( $args{desc} |
|
36
|
|
|
|
|
|
|
? (title => $args{desc}) |
|
37
|
|
|
|
|
|
|
: () |
|
38
|
|
|
|
|
|
|
), |
|
39
|
|
|
|
|
|
|
}, |
|
40
|
|
|
|
|
|
|
); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub get_syntax_map { |
|
44
|
0
|
|
|
0
|
0
|
|
my ($self, $mech) = @_; |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my $res = $mech->get($SYNTAX_CHOICES_URL); |
|
47
|
|
|
|
|
|
|
|
|
48
|
0
|
0
|
|
|
|
|
die "Unable to fetch $SYNTAX_CHOICES_URL: @{[$res->status_line()]}" |
|
|
0
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
unless $res->is_success(); |
|
50
|
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
$mech->back(); |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
return JSON->new->decode($res->content()); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub return { |
|
57
|
0
|
|
|
0
|
1
|
|
my ($self, $mech) = @_; |
|
58
|
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $link = $mech->uri(); |
|
60
|
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
return (1, $link); |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1 && q[Electric Wizard - Return Trip]; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__END__ |