Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

No pastes for you but will not send to #sdl

  • Loading branch information...
commit d2b786f84630743d84cdd8e23307d1ecaa07cdb7 1 parent 8be6ce4
@kthakore kthakore authored
Showing with 86 additions and 0 deletions.
  1. +86 −0 tools/nopaste.pl
View
86 tools/nopaste.pl
@@ -0,0 +1,86 @@
+#!perl
+
+# Copyright (C) 2008, Parrot Foundation.
+# $Id: nopaste.pl 38612 2009-05-08 18:30:25Z Infinoid $
+
+use 5.008;
+use strict;
+use warnings;
+
+use WWW::Mechanize;
+use Getopt::Std;
+use Pod::Usage;
+
+
+my $server = 'scsys.co.uk';
+my $url = "http://$server:8001/paste";
+my $opt = {
+ c => '#sdl', # channel
+ n => getlogin || getpwuid($<) || 'someone', # name
+ t => undef, # title
+};
+
+getopt( 'c:n:t:', $opt );
+
+pod2usage(2)
+ unless defined $opt->{t};
+
+
+my $text; while(<>) { $text .= $_; }
+my $mech = WWW::Mechanize->new(
+ cookie_jar => undef,
+ autocheck => 1,
+);
+
+$mech->get( $url );
+
+$mech->submit_form(
+ form_name => 'pasteForm',
+ fields => {
+ (defined $opt->{c} ?
+ (channel => $opt->{c}) :
+ (channel => '#sdl' )
+ ),
+ nick => $opt->{n},
+ summary => $opt->{t},
+ paste => $text,
+ },
+ button => 'Paste it',
+);
+
+my @link = $mech->links;
+print "Your paste can be found at ", $link[0]->url, "\n";
+
+
+=head1 NAME
+
+tools/dev/nopaste.pl - paste the contents of a file via a pastebot server
+
+=head1 SYNOPSIS
+
+ nopaste.pl -t "TITLE" [ -c CHANNEL ] [ -n NAME ] [ FILENAME ]
+
+ TITLE the title of the paste
+ CHANNEL the irc channel (defaults to #parrot)
+ NAME the username (defaults to username or 'someone')
+ FILENAME the name of the file to paste (defaults to STDIN)
+
+=head1 DESCRIPTION
+
+This program can be used to paste the contents of a file on a pastebot server
+-- specifically, B<nopaste.snit.ch> -- for immediate linkage on an IRC channel --
+by default, B<#sdl>.
+
+=head1 AUTHOR
+
+Originally written by particle, with subsequent contributions to functionality
+by LimbicRegion, paultcochrane and cotto.
+
+=cut
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Please sign in to comment.
Something went wrong with that request. Please try again.