| 1 | use strictscip-perl cpan App-Nopaste 1.013 strict/; |
| 2 | use warningsscip-perl cpan App-Nopaste 1.013 warnings/; |
| 3 | package App::Nopaste::Service::Mojopastescip-perl cpan App-Nopaste 1.013 App/Nopaste/Service/Mojopaste/; |
| 4 | # ABSTRACT: Service provider for mojopaste |
| 5 | |
| 6 | our $VERSIONscip-perl cpan App-Nopaste 1.013 App/Nopaste/Service/Mojopaste/$VERSION. = '1.013'; |
| 7 | |
| 8 | use parentscip-perl cpan App-Nopaste 1.013 parent/ 'App::Nopaste::Service'; |
| 9 | |
| 10 | sub uriscip-perl cpan App-Nopaste 1.013 App/Nopaste/Service/Mojopaste/uri(). { $ENVscip-perl cpan App-Nopaste 1.013 App/Nopaste/Service/Mojopaste/`%ENV`.{NOPASTE_MOJOPASTE_WEBPATH} || 'https://ssl.thorsen.pm/paste' } |
| 11 | |
| 12 | sub fill_formscip-perl cpan App-Nopaste 1.013 App/Nopaste/Service/Mojopaste/fill_form(). { |
| 13 | my $self = shiftscip-perl cpan App-Nopaste 1.013 App/Nopaste/Service/Mojopaste/shift().; |
| 14 | my $mech = shiftscip-perl cpan App-Nopaste 1.013 App/Nopaste/Service/Mojopaste/shift().; |
| 15 | my %args = @_scip-perl cpan App-Nopaste 1.013 App/Nopaste/Service/Mojopaste/`@_`.; |
| 16 | |
| 17 | # Hack around bot protection |
| 18 | my $form = $mech->form_numberscip-perl cpan App-Nopaste 1.013 App/Nopaste/Service/Mojopaste/form_number().(1); |
| 19 | my $action = $form->actionscip-perl cpan App-Nopaste 1.013 App/Nopaste/Service/Mojopaste/action().; |
| 20 | if ($action =~ m{/invalid$}) { |
| 21 | $action =~ s{/invalid$}{}; |
| 22 | $form->actionscip-perl cpan App-Nopaste 1.013 App/Nopaste/Service/Mojopaste/action().($action); |
| 23 | } |
| 24 | |
| 25 | $mech->submit_formscip-perl cpan App-Nopaste 1.013 App/Nopaste/Service/Mojopaste/submit_form().( |
| 26 | fields => { |
| 27 | p => 1, |
| 28 | paste => $args{text}, |
| 29 | }, |
| 30 | ); |
| 31 | |
| 32 | } |
| 33 | |
| 34 | sub returnscip-perl cpan App-Nopaste 1.013 App/Nopaste/Service/Mojopaste/return(). { |
| 35 | my $self = shiftscip-perl cpan App-Nopaste 1.013 App/Nopaste/Service/Mojopaste/shift().; |
| 36 | my $mech = shiftscip-perl cpan App-Nopaste 1.013 App/Nopaste/Service/Mojopaste/shift().; |
| 37 | |
| 38 | my $link = $mech->uriscip-perl cpan App-Nopaste 1.013 App/Nopaste/Service/Mojopaste/uri().(); |
| 39 | |
| 40 | return (1, $link); |
| 41 | } |
| 42 | |
| 43 | |
| 44 | 1; |
| 45 | |
| 46 | __END__ |
| 47 | |
| 48 | =pod |
| 49 | |
| 50 | =encoding UTF-8 |
| 51 | |
| 52 | =for stopwords mojopaste Dean Hamstead |
| 53 | |
| 54 | =head1 NAME |
| 55 | |
| 56 | App::Nopaste::Service::Mojopaste - Service provider for mojopaste |
| 57 | |
| 58 | =head1 VERSION |
| 59 | |
| 60 | version 1.013 |
| 61 | |
| 62 | =head1 USAGE |
| 63 | |
| 64 | By default the mojopaste installed at http://p.thorsen.pm/ is used. |
| 65 | |
| 66 | Point to your local App::mojopaste instance by setting the |
| 67 | NOPASTE_MOJOPASTE_WEBPATH environment variable |
| 68 | |
| 69 | For example: |
| 70 | |
| 71 | # export NOPASTE_MOJOPASTE_WEBPATH=http://paste.local |
| 72 | # cat /proc/cpuinfo | nopaste -s Mojopaste |
| 73 | |
| 74 | =head1 SUPPORT |
| 75 | |
| 76 | Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=App-Nopaste> |
| 77 | (or L<[email protected]|mailto:[email protected]>). |
| 78 | |
| 79 | =head1 AUTHOR |
| 80 | |
| 81 | Dean Hamstead, <[email protected]> |
| 82 | |
| 83 | =head1 COPYRIGHT AND LICENSE |
| 84 | |
| 85 | This software is copyright (c) 2008 by Shawn M Moore. |
| 86 | |
| 87 | This is free software; you can redistribute it and/or modify it under |
| 88 | the same terms as the Perl 5 programming language system itself. |
| 89 | |
| 90 | =cut |