Thursday, May 14, 2009

HOWTO: Paste to pastebin from the command line

You need the script "" from

Here is what I needed to do on Mac OS X to make it work:
  • I needed to have WWW::Mechanize in my Perl modules so I used CPAN's interactive shell to do it:
sudo /usr/bin/cpan
install WWW:Mechanize
  • NOTE: The script points to a specific perl path and that implies a specific CPAN. Remember that we have MacPorts taking preference over default MacOS X installed packages. Use whereis to find this out and compare with the first line of the script.
  • Put the script in a folder which is part of your PATH and set the right permissions

Here is how to use it:
  • paste2pastebin file_to_submit
It will return you the URL for it. The script has more advanced options.

Errors I found which required installing WWW::Mechanize and the second one I am ignoring it every time:
Can't locate WWW/ in @INC (@INC contains: /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /Library/Perl/5.8.1 .) at /Users/armenzg/scripts/ line 23.
BEGIN failed--compilation aborted at /Users/armenzg/scripts/ line 23.
Use of uninitialized value in string ne at /Library/Perl/5.8.8/HTML/ line 704, <> line 555.

Creative Commons License
This work by Zambrano Gasparnian, Armen is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

No comments:

Post a Comment