Skip to content
This repository
Newer
Older
100644 83 lines (61 sloc) 1.788 kb
d2b786f8 »
2009-10-27 No pastes for you but will not send to #sdl
1 #!perl
2
3 # Copyright (C) 2008, Parrot Foundation.
4 # $Id: nopaste.pl 38612 2009-05-08 18:30:25Z Infinoid $
5
6 use 5.008;
7 use strict;
8 use warnings;
9
10 use WWW::Mechanize;
11 use Getopt::Std;
12 use Pod::Usage;
69341787 »
2009-10-27 In Video.xs: removed use of goto. Added set_palette. In core_video.t …
13 use Data::Dumper;
d2b786f8 »
2009-10-27 No pastes for you but will not send to #sdl
14
e6e146ee »
2010-07-20 Did perl tidy. Stole rc from padre. bricas++
15 my $server = 'scsys.co.uk';
16 my $url = "http://$server:8001/paste";
17 my $opt = {
4979eb13 »
2010-07-30 perltidy
18 c => '#sdl', # channel
19 n => getlogin || getpwuid($<) || 'someone', # name
20 t => undef, # title
d2b786f8 »
2009-10-27 No pastes for you but will not send to #sdl
21 };
22
23 getopt( 'c:n:t:', $opt );
24
25 pod2usage(2)
4979eb13 »
2010-07-30 perltidy
26 unless defined $opt->{t};
d2b786f8 »
2009-10-27 No pastes for you but will not send to #sdl
27
e6e146ee »
2010-07-20 Did perl tidy. Stole rc from padre. bricas++
28 my $text;
29 while (<>) { $text .= $_; }
30 my $mech = WWW::Mechanize->new(
4979eb13 »
2010-07-30 perltidy
31 cookie_jar => undef,
32 autocheck => 1,
d2b786f8 »
2009-10-27 No pastes for you but will not send to #sdl
33 );
34
e6e146ee »
2010-07-20 Did perl tidy. Stole rc from padre. bricas++
35 $mech->get($url);
d2b786f8 »
2009-10-27 No pastes for you but will not send to #sdl
36
37 $mech->submit_form(
4979eb13 »
2010-07-30 perltidy
38 form_name => 'pasteForm',
39 fields => {
40 channel => $opt->{c},
41 nick => $opt->{n},
42 summary => $opt->{t},
43 paste => $text,
44 },
45 button => 'Paste it',
d2b786f8 »
2009-10-27 No pastes for you but will not send to #sdl
46 );
47
48 my @link = $mech->links;
49 print "Your paste can be found at ", $link[0]->url, "\n";
50
51 =head1 NAME
52
53 tools/dev/nopaste.pl - paste the contents of a file via a pastebot server
54
55 =head1 SYNOPSIS
56
57 nopaste.pl -t "TITLE" [ -c CHANNEL ] [ -n NAME ] [ FILENAME ]
58
59 TITLE the title of the paste
60 CHANNEL the irc channel (defaults to #parrot)
61 NAME the username (defaults to username or 'someone')
62 FILENAME the name of the file to paste (defaults to STDIN)
63
64 =head1 DESCRIPTION
65
66 This program can be used to paste the contents of a file on a pastebot server
67 -- specifically, B<nopaste.snit.ch> -- for immediate linkage on an IRC channel --
68 by default, B<#sdl>.
69
70 =head1 AUTHOR
71
72 Originally written by particle, with subsequent contributions to functionality
73 by LimbicRegion, paultcochrane and cotto.
74
75 =cut
76
77 # Local Variables:
78 # mode: cperl
79 # cperl-indent-level: 4
80 # fill-column: 100
81 # End:
82 # vim: expandtab shiftwidth=4:
Something went wrong with that request. Please try again.