1 | #! perl |
1 | #! perl |
|
|
2 | |
|
|
3 | #:META:X_RESOURCE:%.cmd:string:the command to run create a new pastebin |
|
|
4 | #:META:X_RESOURCE:%.url:string:the url template for new pastebins |
2 | |
5 | |
3 | sub upload_paste { |
6 | sub upload_paste { |
4 | my ($self) = @_; |
7 | my ($self) = @_; |
5 | |
8 | |
6 | require Digest::MD5; |
9 | require Digest::MD5; |
… | |
… | |
24 | } |
27 | } |
25 | |
28 | |
26 | my $cmd = $self->{pastebin_cmd}; |
29 | my $cmd = $self->{pastebin_cmd}; |
27 | $cmd =~ s/%/$tmpfile/; |
30 | $cmd =~ s/%/$tmpfile/; |
28 | |
31 | |
29 | my $pid = $self->exec_async ("/bin/sh", "-c", $cmd); |
32 | my $pid = $self->exec_async ($cmd); |
30 | |
33 | |
31 | $self->{pw} = urxvt::pw->new->start ($pid)->cb (sub { |
34 | $self->{pw} = urxvt::pw->new->start ($pid)->cb (sub { |
32 | my (undef, $status) = @_; |
35 | my (undef, $status) = @_; |
33 | |
36 | |
34 | delete $self->{pw}; |
37 | delete $self->{pw}; |