line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
21503
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
26
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
74
|
|
3
|
|
|
|
|
|
|
package App::Nopaste::Service::WerePaste; |
4
|
|
|
|
|
|
|
{ |
5
|
|
|
|
|
|
|
$App::Nopaste::Service::WerePaste::VERSION = '0.02'; |
6
|
|
|
|
|
|
|
} |
7
|
1
|
|
|
1
|
|
922
|
use Encode qw/decode_utf8/; |
|
1
|
|
|
|
|
12129
|
|
|
1
|
|
|
|
|
86
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
8
|
use base q/App::Nopaste::Service/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
783
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# ABSTRACT: nopaste service for L |
12
|
|
|
|
|
|
|
|
13
|
0
|
0
|
|
0
|
1
|
|
sub uri { $ENV{WEREPASTE_URL} || 'http://paste.were.space/' } |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub get { |
16
|
0
|
|
|
0
|
1
|
|
my ($self, $mech) = @_; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Set BasicAuth credentials if needed |
19
|
0
|
0
|
|
|
|
|
$mech->credentials( $self->_credentials ) if $self->_credentials; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
return $mech->get($self->uri); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub fill_form { |
25
|
0
|
|
|
0
|
1
|
|
my ($self, $mech) = (shift, shift); |
26
|
0
|
|
|
|
|
|
my %args = @_; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $content = { |
29
|
|
|
|
|
|
|
code => decode_utf8($args{text}), |
30
|
|
|
|
|
|
|
title => decode_utf8($args{desc}), |
31
|
0
|
|
|
|
|
|
lang => decode_utf8($args{lang}), |
32
|
|
|
|
|
|
|
}; |
33
|
0
|
|
|
|
|
|
my $exp = $ENV{WEREPASTE_EXP}; |
34
|
0
|
0
|
|
|
|
|
$content->{expiration} = $exp if $exp; |
35
|
0
|
0
|
|
|
|
|
$mech->credentials( $self->_credentials ) if $self->_credentials; |
36
|
0
|
|
|
|
|
|
@{$mech->requests_redirectable} = (); |
|
0
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return $mech->submit_form( form_number => 1, fields => $content ); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub return { |
42
|
0
|
|
|
0
|
1
|
|
my ( $self, $mech ) = @_; |
43
|
0
|
0
|
|
|
|
|
return (1, $mech->response->header('Location')) if $mech->response->is_redirect; |
44
|
0
|
|
|
|
|
|
return (0, 'Cannot find URL'); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
0
|
|
|
sub _credentials { ($ENV{WEREPASTE_USER}, $ENV{WEREPASTE_PASS}) } |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
__END__ |