NAME

Algorithm::URL::Shorten - URL shortening algorithm.

VERSION

Version 0.01

SYNOPSIS

Algorithm::URL::Shorten generates short codes used to map and represent longer URLs.

use Algorithm::URL::Shorten qw(shorten_url);

my $shorts = shorten_url("http://perl.org", 6);

foreach $code (@{$shorts}) {
    print $code, "\n";
}

This code prints

isazkm
mBvzxc
soerqC
dtvydF

DESCRIPTION

The codes generated with Algorithm::URL::Shorten are unique for every URL, so that every time it is used on the same URL, it will generate the same codes.

The short strings are alphanumeric ASCII ([a-z], [A-Z], and [0-9]) for a total of 62 characters, which may be mapped in, depending on the lenght, 62 ^ n codes (where n is the actual size of the strings generated).

EXPORT

The module exports the subroutine 'shorten_url' on request.

SUBROUTINES/METHODS

shorten_url( $url, $short_lenght)

This function takes as arguments an URL to shorten, and the desired lenght of the shortened values, and returns an array reference containing 4 values.

The $short_lenght may be set to numbers <= 7, due to the fixed lenght of an md5 hash, which is used by the algorithm.

AUTHOR

Alessandro Ghedini, <alexbio at cpan.org>

BUGS

Please report any bugs or feature requests to bug-algorithm-url-shorten at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Algorithm-URL-Shorten. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Algorithm::URL::Shorten

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright 2010 Alessandro Ghedini.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.