Thursday, February 10, 2011

Perl and Pastebin.com

Yes, this is me posting at midnight. Yes, my postcount has been skyrocketing, probably because I've been trying to distract myself from the huge stress that is exams. Yes, it's working. Yes, that is bad.

Anyways, I googled around trying to look for a good perl pastebin uploader and couldn't find one, so I adapted one that I found to actually work well. It's about as simple as it gets, fellow perl readers should be able to look through the code that I'm about to paste in (thanks to my shiny new perl script). My code is far from perfect, I'm planning on perfecting it by allowing me to not have to run any commands at all, which would be great considering the fact that I'm having to generate the filename (which is currently in the format of date +%m-%d-%y.title), pipe the command to the perl script (which chops off newlines and transforms my code tags into pastebins) and upload it from GoogleCL (which, by the way, is another amazing command line tool.)

And now, the moment you've all been waiting for, my code:

2 comments:

  1. App::Nopaste is available on CPAN. It has App::Nopaste::Service::PastebinCom plugin for http://pastebin.com/

    ReplyDelete
  2. thanks so much!! i'll be sure to check it out.

    ReplyDelete