Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 84 lines (60 sloc) 1.852 kB
d2b786f @kthakore 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 @kthakore In Video.xs: removed use of goto. Added set_palette. In core_video.t …
kthakore authored
13 use Data::Dumper;
d2b786f @kthakore No pastes for you but will not send to #sdl
kthakore authored
14
15 my $server = 'scsys.co.uk';
16 my $url = "http://$server:8001/paste";
17 my $opt = {
18 c => '#sdl', # channel
19 n => getlogin || getpwuid($<) || 'someone', # name
20 t => undef, # title
21 };
22
23 getopt( 'c:n:t:', $opt );
24
25 pod2usage(2)
26 unless defined $opt->{t};
27
28
29 my $text; while(<>) { $text .= $_; }
30 my $mech = WWW::Mechanize->new(
31 cookie_jar => undef,
32 autocheck => 1,
33 );
34
35 $mech->get( $url );
36
37 $mech->submit_form(
38 form_name => 'pasteForm',
39 fields => {
6934178 @kthakore In Video.xs: removed use of goto. Added set_palette. In core_video.t …
kthakore authored
40 channel => $opt->{c},
d2b786f @kthakore No pastes for you but will not send to #sdl
kthakore authored
41 nick => $opt->{n},
42 summary => $opt->{t},
43 paste => $text,
44 },
45 button => 'Paste it',
46 );
47
48 my @link = $mech->links;
49 print "Your paste can be found at ", $link[0]->url, "\n";
50
51
52 =head1 NAME
53
54 tools/dev/nopaste.pl - paste the contents of a file via a pastebot server
55
56 =head1 SYNOPSIS
57
58 nopaste.pl -t "TITLE" [ -c CHANNEL ] [ -n NAME ] [ FILENAME ]
59
60 TITLE the title of the paste
61 CHANNEL the irc channel (defaults to #parrot)
62 NAME the username (defaults to username or 'someone')
63 FILENAME the name of the file to paste (defaults to STDIN)
64
65 =head1 DESCRIPTION
66
67 This program can be used to paste the contents of a file on a pastebot server
68 -- specifically, B<nopaste.snit.ch> -- for immediate linkage on an IRC channel --
69 by default, B<#sdl>.
70
71 =head1 AUTHOR
72
73 Originally written by particle, with subsequent contributions to functionality
74 by LimbicRegion, paultcochrane and cotto.
75
76 =cut
77
78 # Local Variables:
79 # mode: cperl
80 # cperl-indent-level: 4
81 # fill-column: 100
82 # End:
83 # vim: expandtab shiftwidth=4:
Something went wrong with that request. Please try again.