| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WebService::Pastefire; |
|
2
|
2
|
|
|
2
|
|
794
|
use 5.008001; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
85
|
|
|
3
|
2
|
|
|
2
|
|
2311
|
use utf8; |
|
|
2
|
|
|
|
|
23
|
|
|
|
2
|
|
|
|
|
11
|
|
|
4
|
2
|
|
|
2
|
|
70
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
68
|
|
|
5
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
68
|
|
|
6
|
2
|
|
|
2
|
|
1933
|
use parent 'Class::Accessor::Fast'; |
|
|
2
|
|
|
|
|
646
|
|
|
|
2
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw! |
|
8
|
|
|
|
|
|
|
username password expire url max |
|
9
|
|
|
|
|
|
|
!); |
|
10
|
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
9681
|
use Carp; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
192
|
|
|
12
|
2
|
|
|
2
|
|
2279
|
use LWP::Simple; |
|
|
2
|
|
|
|
|
260452
|
|
|
|
2
|
|
|
|
|
20
|
|
|
13
|
2
|
|
|
2
|
|
1082
|
use URI; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
721
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
1
|
16
|
sub new { my $class = shift; #{{{ |
|
17
|
2
|
50
|
|
|
|
8
|
my $args = ref $_[0] ? $_[0] : +{@_}; |
|
18
|
2
|
100
|
66
|
|
|
32
|
croak 'please specify email & password' |
|
19
|
|
|
|
|
|
|
unless defined $args->{username} && defined $args->{password}; |
|
20
|
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
18
|
return $class->SUPER::new(+{ |
|
22
|
|
|
|
|
|
|
url => 'https://pastefire.com/set_bookmarklet.php', |
|
23
|
|
|
|
|
|
|
expire => 3600, |
|
24
|
|
|
|
|
|
|
max => 300, |
|
25
|
|
|
|
|
|
|
%$args, |
|
26
|
|
|
|
|
|
|
}); |
|
27
|
|
|
|
|
|
|
} #}}} |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
0
|
1
|
|
sub paste { my ($self, $str) = @_; #{{{ |
|
30
|
0
|
0
|
|
|
|
|
substr($str, -3) = '...' if $self->max < length $str; |
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $uri = URI->new($self->url); |
|
33
|
0
|
|
|
|
|
|
$uri->query_form( |
|
34
|
|
|
|
|
|
|
clipboard => $str, |
|
35
|
|
|
|
|
|
|
email => $self->username, |
|
36
|
|
|
|
|
|
|
pwd => $self->password, |
|
37
|
|
|
|
|
|
|
kexp => $self->expire, |
|
38
|
|
|
|
|
|
|
optin => 0, |
|
39
|
|
|
|
|
|
|
); |
|
40
|
0
|
|
|
|
|
|
my $res = get($uri->as_string); |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
if ($res eq $str) { |
|
43
|
0
|
|
|
|
|
|
return 1; |
|
44
|
|
|
|
|
|
|
} else { |
|
45
|
0
|
|
|
|
|
|
return 0; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
} #}}} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
|
50
|
|
|
|
|
|
|
__END__ |