String::Random::NiceURL - create random ID strings for URLs by only using the modified Base64 characters
Version 0.01
use String::Random::NiceURL qw(id); my $id = id(6); print "id=$id\n";
This module allows you to create sparse and distributed IDs such as those used for YouTube videos. It uses a modified base 64 character set but also makes sure that the first and last chars of your ID are not the dash or underscore characters (this helps some programs detect the URLs correctly, for example when double-clicking to highlight the text).
Any length IDs (greater than two chars) can be created and could be used for blog posts, short URLs, images, videos and many other entities.
Other uses could be salts, session IDs, tokens when checking email addresses and nonces for XSRF tokens.
As an example, let's generate an ID of length 6:
This could print something like (for values of 2, 6, 11, 32):
id(2) => 6p id(6) => NIK_qV id(11) => 2qUROkj-1X6 id(32) => sTQ9TP-Y-2cpKlL1f2-6VCgWvAYTZTDB ...etc...
This is the only method provided by this module. It can be exported, or called as such:
String::Random::NiceURL::id($length)
It will return an example ID string of the specified number of characters.
If the length if not provided, non-numeric or less than two, the function will croak with a user-error message.
Andrew Chilton, <andy at chilts dot org>
<andy at chilts dot org>
Please report any bugs or feature requests to bug-string-random-niceurl at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=String-Random-NiceURL. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-string-random-niceurl at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc String::Random::NiceURL
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=String-Random-NiceURL
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/String-Random-NiceURL
CPAN Ratings
http://cpanratings.perl.org/d/String-Random-NiceURL
Search CPAN
http://search.cpan.org/dist/String-Random-NiceURL
Copyright (c) 2010, Apps Attic Ltd, all rights reserved.
http://www.appsattic.com/
This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
To install String::Random::NiceURL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm String::Random::NiceURL
CPAN shell
perl -MCPAN -e shell install String::Random::NiceURL
For more information on module installation, please visit the detailed CPAN module installation guide.