WWW::Shorten::5gp - Perl interface to 5.gp - those are some short URLs!
use WWW::Shorten '5gp'; $short_url = makeashorterlink($long_url); $long_url = makealongerlink($short_url);
A Perl interface to the web site 5.gp. 5gp simply maintains a database of long URLs, each of which has a unique identifier.
5.gp has the benefit of being pretty reliable (so far) as well as having a really tiny domain name. The domain name makes tinyurl.com seem to be not so tiny at all!
You can use the shorten function from the command line:
$ shorten --service 5gp https://huntingbears.nl http://5.gp/jfRX
If you always want to use the 5gp service you can create a small configuration file in your home directory:
$ cat ~/.shortenrc service = 5gp $ shorten https://duckduckgo.com http://5.gp/jfRY
and if you'd like to make your short urls in your code, use the library.
The function makeashorterlink will call the 5gp web site passing it your long URL and will return the shorter 5gp version.
makeashorterlink
The function makealongerlink does the reverse. makealongerlink will accept as an argument either the full 5gp URL or just the 5gp identifier.
makealongerlink
If anything goes wrong, then either function will return undef.
undef
makeashorterlink, makealongerlink
See the main WWW::Shorten docs.
This software is copyright (c) 2015 by Michiel Beijen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
https://github.com/mbeijen/WWW-Shorten-5gp
Michiel Beijen <michiel.beijen@gmail.com>
I am not affiliated with 5.gp - I just like short domains!
WWW::Shorten, perl, http://5.gp/
To install WWW::Shorten::5gp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Shorten::5gp
CPAN shell
perl -MCPAN -e shell install WWW::Shorten::5gp
For more information on module installation, please visit the detailed CPAN module installation guide.