| 1 | package App::Nopaste::Service::dpaste; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | |||||||||||||||
| 6 | 1 | ▶ | use JSON (); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | |||||||||||||||
| 8 | 1 | our $VERSION = '0.03'; | |||||||||||||
| 9 | |||||||||||||||
| 10 | 1 | our $SYNTAX_CHOICES_URL = 'http://dpaste.com/api/v2/syntax-choices/'; | |||||||||||||
| 11 | |||||||||||||||
| 12 | 1 | ▶ | use base 'App::Nopaste::Service'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 13 | |||||||||||||||
| 14 | 0 | ▶ | sub uri { 'http://dpaste.com/' } | ||||||||||||
|
Subroutine
uri: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 15 | |||||||||||||||
| 16 | 0 | ▶ | sub fill_form { | ||||||||||||
|
Subroutine
fill_form: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||
| 17 | 0 | my ($self, $mech, %args) = @_; | |||||||||||||
| 18 | |||||||||||||||
| 19 | 0 | my $syntax_map = $self->get_syntax_map($mech); | |||||||||||||
| 20 | |||||||||||||||
| 21 | my $syntax = $syntax_map->{$args{lang}} | ||||||||||||||
| 22 | ? $syntax_map->{$args{lang}} | ||||||||||||||
| 23 | 0 | ▶ | : $syntax_map->{text}; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 24 | |||||||||||||||
| 25 | $mech->submit_form( | ||||||||||||||
| 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 | 0 | ▶ | : () | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 38 | ), | ||||||||||||||
| 39 | }, | ||||||||||||||
| 40 | ); | ||||||||||||||
| 41 | } | ||||||||||||||
| 42 | |||||||||||||||
| 43 | 0 | ▶ | sub get_syntax_map { | ||||||||||||
|
Subroutine
get_syntax_map: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||
| 44 | 0 | my ($self, $mech) = @_; | |||||||||||||
| 45 | |||||||||||||||
| 46 | 0 | my $res = $mech->get($SYNTAX_CHOICES_URL); | |||||||||||||
| 47 | |||||||||||||||
| 48 | 0 | ▶ | die "Unable to fetch $SYNTAX_CHOICES_URL: @{[$res->status_line()]}" | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 49 | unless $res->is_success(); | ||||||||||||||
| 50 | |||||||||||||||
| 51 | 0 | $mech->back(); | |||||||||||||
| 52 | |||||||||||||||
| 53 | 0 | return JSON->new->decode($res->content()); | |||||||||||||
| 54 | } | ||||||||||||||
| 55 | |||||||||||||||
| 56 | 0 | ▶ | sub return { | ||||||||||||
|
Subroutine
return: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 57 | 0 | my ($self, $mech) = @_; | |||||||||||||
| 58 | |||||||||||||||
| 59 | 0 | my $link = $mech->uri(); | |||||||||||||
| 60 | |||||||||||||||
| 61 | 0 | return (1, $link); | |||||||||||||
| 62 | } | ||||||||||||||
| 63 | |||||||||||||||
| 64 | 1 | 1 && q[Electric Wizard - Return Trip]; | |||||||||||||
| 65 | |||||||||||||||
| 66 | __END__ | ||||||||||||||