|
|
A Perl script to create Tiny URLs
Thanks a lot for these so many ideas...
I have improved a little bit the Perl code (that I consider more usable and flexible than specific AppleScripts or long specific curl command lines with many scaped chars!)
#!/usr/bin/env perl
#
# testtinyurl.pl
#
# juanfc 2006-06-30
#
#
use strict;
use warnings;
# use WWW::Shorten 'BabyURL';
# use WWW::Shorten 'Linkz';
# use WWW::Shorten 'MakeAShorterLink';
# use WWW::Shorten 'Metamark';
# use WWW::Shorten 'NotLong';
# use WWW::Shorten 'OneShortLink';
# use WWW::Shorten 'Shorl';
# use WWW::Shorten 'SnipURL';
# use WWW::Shorten 'TinyClick';
# use WWW::Shorten 'TinyLink';
use WWW::Shorten 'TinyURL';
use Data::Validate::URI qw(is_uri);
if (!@ARGV) {
my $a = `pbpaste`;
if ( !is_uri($a) ) {
$a = "http://$a";
}
my $small = makeashorterlink($a);
system("echo -n $small | pbcopy" );
print "$smalln";
} else {
foreach my $a (@ARGV) {
if ( !is_uri($a) ) {
$a = "http://$a";
}
print makeashorterlink("$a"), "n";
}
}
If you want to use NotLong (very interesting), you can set the preferred nickname easily:
makeashorterlink($long_url,nickname=>$nickname);but the philosophy of NotLong seems to be more to have a real nickname for a stable site. It's pity WWW::Shorten doesn't have support for urlx.org. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.09 seconds |
|