The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::Lujoyglamour - Create short URLs with luxury and glamour

VERSION

This document describes Net::Lujoyglamour version 0.0.3.1

SYNOPSIS

    use Net::Lujoyglamour qw(is_valid);

    #Deploy database
    my $dsn = 'dbi:SQLite:dbname=:memory:';
    my $schema = Net::Lujoyglamour->connect($dsn);
    $schema->deploy({ add_drop_tables => 1});

    #Most straighforward way to use
    if ( is_valid( "shortie" ) {
        $schema->create_new_short( "very.long.url/like/this",
                                   "shortie" );
    }
    $schema->create_new_short( "even.longer.url/this/and/that" );

DESCRIPTION

Model/Control part of a framework intended for creating short URLs. Inherits from DBIx::Class; adds functionality for creating a keeping a table of long/short URLs. Funky name comes from the novel lujoyglamour.net , in Spanish, which I also wrote (and obtained a literary price), and you can check out at http://lujoyglamour.es or buy at http://compra.lujoyglamour.net.

INTERFACE

connect( $dsn[, $username] [, $password] [, \%attr] )

Actually, inherited from DBIx::Class, but useful here too

deploy

Also inherited, used for creating the database from the schema description in the class

is_valid( $string )

Check for requested short URL validity; only alphanumeric characters are allowed

generate_candidate_url

Generates a random URL with the character limitation set. It checks URLs with increasing size, until it finds one.

create_new_short ( $long_url[, $short_url] )

Creates and inserts into the database a new short URL, optionally using a requested short URL.

DIAGNOSTICS

Url space exhausted!!

No more URLs availables. You probably have a very successful URL shortener site. You already used up all available short addresses. Time to expand your database!

Invalid short URL $want_short

Requested URL invalid

CONFIGURATION AND ENVIRONMENT

You need to have a database system ready and able. If there's none installed, SQLite will do nicely.

DEPENDENCIES

DBIx::Class, String::Random and drivers for database system.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

Other than the limited space available, for the time being there are none.

Please report any bugs or feature requests to bug-net-lujoyglamour@rt.cpan.org, or through the web interface at http://rt.cpan.org.

SEE ALSO

The module is used with a SQLite database at the site http://lugl.info/. Any comments and suggestions are welcome.

Other URL shortening modules you might want to check out are CGI::Shorten, WWW::Shorten::MakeAShorterLink and WWW::Shorten, which is rather an interface for available URL shortening services.

There is an example app at the aptly named app directory, retrieve it from your CPAN directory or from the CPAN website.

AUTHOR

JJ Merelo <jj@merelo.net>

LICENCE AND COPYRIGHT

Copyright (c) 2009, JJ Merelo <jj@merelo.net>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.