From 1cb4276c570063e5c11f5f673753adf860cbb2df Mon Sep 17 00:00:00 2001 From: jluehrs2 Date: Fri, 5 Oct 2007 18:29:02 -0500 Subject: add eidolos's nopaste script, modified to use rafb --- bin/nopaste | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 bin/nopaste (limited to 'bin/nopaste') diff --git a/bin/nopaste b/bin/nopaste new file mode 100644 index 0000000..f9750b6 --- /dev/null +++ b/bin/nopaste @@ -0,0 +1,57 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use WWW::Mechanize; +use Getopt::Long; + +my $nick = $ENV{USER}; +my $lang = "C"; +my $desc = ""; +my $tabs = "No"; +my $text = ""; +my $host = "rafb.net/paste"; + +sub usage { + print <<"END_USAGE"; +Usage: $0 + Reads paste from STDIN + + Options: + + --nick=NICK Paste as NICK (default \$USER) + --language= Set the language for syntax highlighting + --description= Set the paste description + --tabs= Set how many spaces a tab should be + --host= Use a different host other than $host + +END_USAGE + + exit(-1); +} + +GetOptions("nick=s" => \$nick, + "language=s" => \$lang, + "description=s" => \$desc, + "tabs=s" => \$tabs, + "host=s" => \$host) +or usage(); + +$text = do { local $/; <> }; + +my $mech = WWW::Mechanize->new(); + +$mech->get("http://$host"); + +$mech->submit_form( + form_number => 1, + fields => { + nick => $nick, + lang => $lang, + desc => $desc, + cvt_tabs => $tabs, + text => $text, + } +); + +print "Pasted to: " . $mech->uri(), "\n"; -- cgit v1.2.3-54-g00ecf