Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 83 lines (61 sloc) 1.788 kb
d2b786f Kartik Thakore No pastes for you but will not send to #sdl
kthakore authored
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;
6934178 Kartik Thakore In Video.xs: removed use of goto. Added set_palette. In core_video.t tes...
kthakore authored
13 use Data::Dumper;
d2b786f Kartik Thakore No pastes for you but will not send to #sdl
kthakore authored
14
e6e146e Kartik Thakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored
15 my $server = 'scsys.co.uk';
16 my $url = "http://$server:8001/paste";
17 my $opt = {
4979eb1 Jeffrey T. Palmer perltidy
jtpalmer authored
18 c => '#sdl', # channel
19 n => getlogin || getpwuid($<) || 'someone', # name
20 t => undef, # title
d2b786f Kartik Thakore No pastes for you but will not send to #sdl
kthakore authored
21 };
22
23 getopt( 'c:n:t:', $opt );
24
25 pod2usage(2)
4979eb1 Jeffrey T. Palmer perltidy
jtpalmer authored
26 unless defined $opt->{t};
d2b786f Kartik Thakore No pastes for you but will not send to #sdl
kthakore authored
27
e6e146e Kartik Thakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored
28 my $text;
29 while (<>) { $text .= $_; }
30 my $mech = WWW::Mechanize->new(
4979eb1 Jeffrey T. Palmer perltidy
jtpalmer authored
31 cookie_jar => undef,
32 autocheck => 1,
d2b786f Kartik Thakore No pastes for you but will not send to #sdl
kthakore authored
33 );
34
e6e146e Kartik Thakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored
35 $mech->get($url);
d2b786f Kartik Thakore No pastes for you but will not send to #sdl
kthakore authored
36
37 $mech->submit_form(
4979eb1 Jeffrey T. Palmer perltidy
jtpalmer authored
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',
d2b786f Kartik Thakore No pastes for you but will not send to #sdl
kthakore authored
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.