Usually, I make TinyURLs with this Dashboard widget. However, I get a bit frustrated due to the delay when a widget is launched for the first time. I love Tiny URLs for two reasons: (1) they fit in any mail or forum list with restricted line width support; and (2) they hide the address and then make it more surprising for the reader to open the URL.
So instead, here's a small Perl program that takes the contents of the clipboard (if no arguments are provided) or converts each argument into a Tiny URL, and then prints the Tiny URL version to the standard output.
#!/usr/bin/env perl
#
# testtinyurl.pl
#
# juanfc 2006-06-30
#
#
use WWW::Shorten::TinyURL;
use WWW::Shorten 'TinyURL';
if (!@ARGV) {
$small = makeashorterlink(`pbpaste`);
system("echo -n $small | pbcopy" );
print "$smalln";
} else {
foreach $a (@ARGV) {
print makeashorterlink($a), "n";
}
}
As you can see you need WWW::Shorten::TinyURL, and this was the first problem for me since...
sudo perl -MCPAN -e 'install WWW::Shorten::TinyURL'
...failed in tests and couldn't install it. Finally, I found one to download on Dave Cross' CPAN page. When you install it, be careful with the place it wants to install. It will try to install into /Library -> Perl -> 5.8.6 -> lib -> perl5 -> site_perl -> WWW. That is wrong; you must move it to /Library/Perl/5.8.6/WWW/.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20060630042634381