Fixed the pod path in archive
[sdlgit/SDL_perl.git] / tools / nopaste.pl
CommitLineData
d2b786f8 1#!perl
2
3# Copyright (C) 2008, Parrot Foundation.
4# $Id: nopaste.pl 38612 2009-05-08 18:30:25Z Infinoid $
5
6use 5.008;
7use strict;
8use warnings;
9
10use WWW::Mechanize;
11use Getopt::Std;
12use Pod::Usage;
69341787 13use Data::Dumper;
d2b786f8 14
15my $server = 'scsys.co.uk';
16my $url = "http://$server:8001/paste";
17my $opt = {
18 c => '#sdl', # channel
19 n => getlogin || getpwuid($<) || 'someone', # name
20 t => undef, # title
21};
22
23getopt( 'c:n:t:', $opt );
24
25pod2usage(2)
26 unless defined $opt->{t};
27
28
29my $text; while(<>) { $text .= $_; }
30my $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 => {
69341787 40 channel => $opt->{c},
d2b786f8 41 nick => $opt->{n},
42 summary => $opt->{t},
43 paste => $text,
44 },
45 button => 'Paste it',
46);
47
48my @link = $mech->links;
49print "Your paste can be found at ", $link[0]->url, "\n";
50
51
52=head1 NAME
53
54tools/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
67This 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 --
69by default, B<#sdl>.
70
71=head1 AUTHOR
72
73Originally written by particle, with subsequent contributions to functionality
74by 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: