View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Алексей Суриков > TinyURL-RU > TinyURL::RU



Annotate this POD

View/Report Bugs
Module Version: 0.06   Source  


TinyURL::RU - shorten URLs with (aka


    use TinyURL::RU qw(shorten lengthen);
    my $long  = '';
    my $short = shorten($long);
    $long     = lengthen($short);


This module provides you a very simple interface to URL shortening site (aka

IMPORTANT NOTE: checks all incoming URLs for blacklisting.


$short = shorten($long [, $prefix, $suffix, %options])

Takes long URL as first argument and returns its tiny version (or undef on error).

Optionaly you can pass $prefix and/or $suffix for tiny URL and some other options.

$prefix will be used as subdomain in shortened URL.

$suffix will be used as path in shortened URL.

Note: passing $prefix and/or $suffix may cause shortening fail if $prefix or $suffix is already taken by someone for different URL address.

There are some prefixes and suffixes which are reserved by for its own purposes:

prefixes: www, bfm

suffixes: personal

%options are:


Lets you to re-use same (almost) $suffix for different URLs.

Implemented by automatical appending of an incremental number (starts with 1) on repeated requests with the same $suffix and different URLs.

Note: this options works only with $suffix passed.

Simple example:

    $short = shorten($long1, 'hello');          # $short eq ''
    $short = shorten($long2, 'hello', 'world'); # $short eq ''
    $short = shorten($long2, 'hello', 'world'); # $short eq '' (again)

Incremental example:

    $short = shorten($long1, undef, 'hello');                # $short eq ''
    $short = shorten($long2, undef, 'hello');                # short is undefined because 'hello' suffix already exists for $long1
    $short = shorten($long2, undef, 'hello', increment => 1) # $short eq ''
    $short = shorten($long3, undef, 'hello', increment => 1) # $short eq ''

$long = lengthen($short)

Takes shortened URL (or its path part) as argument and returns its original version (or undef on error).

Returned value is a valid UTF-8 string with URL within it.


Алексей Суриков <>


There is a small convenience for you: a plugin for WWW::Shorten comes with this distribution.

See WWW::Shorten::TinyURL::RU.




This program is free software, you can redistribute it under the same terms as Perl itself.

syntax highlighting: