Here is a Perl module for a URL shortener service and an example script showing its usage.
Also URL shortener scripts for ekg2 (http://www.ekg2.org/) and weechat (http://www.weechat.org/) are available!
Here's description of files.
- ShortIsGd.pm
-
Perl module for the is.gd URL shortener service. Documentation of the module is included inside it. Execute 'perldoc ShortIsGd.pm' or open the file in any text editor to see it.
- short.pl
-
Example script showing usage of the ShortIsGd module.
Unlike most of the URL shorteners, the ones described below "cut" the links only when requested!
The script provides a "/cut" command. Type "/cut help" after loading it to see help.
The script is given in two versions. They're equally functional.
- ekg2_urlshort.pl
-
This version has to be used with ShortIsGd.pm which is available here too. Put the .pm file (Perl module) in any directory where perl looks for its modules. One of such directories is usually the one from where the application was started.
- ekg2_urlshort_sam.pl
-
This script already contains ShortIsGd, so you'll need only it.
Perl
LWP::UserAgent
(libwww-perl, dev-perl/libwww-perl)
URI::Escape
(liburi-perl, dev-perl/URI)
ekg2
Available from http://www.ekg2.org/download.php or from https://github.com/leafnode/ekg2.
The script can be loaded using this command: /script +/path/script.pl. If it doesn't work, try this: /perl:load /path/script.pl.
You may need to load Perl plugin first: /plugin +perl.
The script provides a "/cut" command. Type "/help cut" after loading it to see help.
It works the same way as the one for ekg2, described above. It depends on the same module, and the note about where to put ShortIsGd.pm applies here too.
Same as above, except that you need weechat.
Load the script using: /perl load weechat_urlshort.pl.