WWW::Shorten::RevCanonical - Shorten URL using rev="canonical"
use WWW::Shorten 'RevCanonical'; my $short_url = makeashorterlink($long_url); # Note that this could fail and return undef # Or, use WWW::Shorten::Simple wrapper use WWW::Shorten::Simple; my @shorteners = ( WWW::Shorten::Simple->new('RevCanonical'), # Try this first WWW::Shorten::Simple->new('TinyURL'), # Then fallback to TinyURL ); my $short_url; for my $shortener (@shorteners) { $short_url = $shortener->shorten($long_url) and last; }
WWW::Shorten::RevCanonical is a WWW::Shorten plugin to extract rev="canonical" link from HTML web pages. Unlike other URL shortening services, the ability to make a short URL from rev="canonical" depends on whether the target site implements the tag, so the call to makeashorterlink could fail, and in that case you'll get undef result. You might want to fallback to other shorten services like TinyURL.
makeashorterlink
Tatsuhiko Miyagawa <miyagawa@bulknews.net>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
WWW::Shorten, WWW::Shoten::Simple, http://revcanonical.wordpress.com/
To install WWW::Shorten::RevCanonical, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Shorten::RevCanonical
CPAN shell
perl -MCPAN -e shell install WWW::Shorten::RevCanonical
For more information on module installation, please visit the detailed CPAN module installation guide.