A quick and very dirty pastebot.

I started a new job. One that requires me to leave the house on a regular basis. And talk to people in the day time, in person. In fact I'm finding it not much different to normal. It seems that instant message is the first line of communication, and people will come and talk to you if you have mutual cycles available at the time. Plus there's a contingent of remote staff, so IM is still important.

When you have IM communication between programmers, you need a pastebin as well. The new guys are using bitbucket that doesn't have that facility, and I wasn't happy with suggesting using a public pastebot. So here's something that does the job. I don't think it's ideal but it achieves 90% of the job in a tiny amount of time.

#!/usr/bin/env perl
use warnings;
use strict;
use URI;
use CGI::Simple;
my $q = CGI::Simple->new;
my $idx = int rand 1000000;

my $paste = URI->new( 'https://your.mediawiki.install.uri');
$paste->query_form(title => "Paste/$idx", action => 'edit');
$q->redirect( -uri => $paste,
                      -nph => 1);

Leave a comment

About kd

user-pic Australian perl hacker. Lead author of the Definitive Guide to Catalyst. Dabbles in javascript, social science and statistical analysis.