The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

String::Random::NiceURL - create random ID strings for URLs by only using the modified Base64 characters

VERSION

Version 0.01

SYNOPSIS

    use String::Random::NiceURL qw(id);
    my $id = id(6);
    print "id=$id\n";

DESCRIPTION

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:

    use String::Random::NiceURL qw(id);
    my $id = id(6);
    print "id=$id\n";

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...

EXPORT_OK

id

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.

AUTHOR

Andrew Chilton, <andy at chilts dot org>

BUGS

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.

SUPPORT

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

    perldoc String::Random::NiceURL

You can also look for information at:

COPYRIGHT & LICENSE

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.