Kenichi Ishigaki


WWW::Lengthen - lengthen 'shortened' urls


    use WWW::Lengthen;
    my $lenghtener = WWW::Lenghten->new;
    my $lengthened_url = $lengthener->try($url);

    # if you find some new and unsupported shortener service
    $lengthener->add( ServiceName => qr{^} );

    # or you may add some known extra services
    $lengthener->add( %WWW::Lengthen::ExtraServices );


There are a bunch of URL shortening services around the world. They have slightly different APIs to shorten URLs but the lengthening part is always the same: follow the shortened URL and see the redirect.

This module tries all the known services to find a longer URL. You may say we can do it with WWW::Shorten family but you can't say which services people use to shorten URLs. You can select some specific shortening service for your website to shorten longer URLs automatically, but spammers may post URLs shortened with other shortening services to avoid offensive URLs they post to be disclosed by clever client tools that know which shortening service your site uses.

Well, this is a cat and mouse game but I hope this help you a bit, at least to save time copying and pasting to create another WWW::Shorten subclass and load it just to lengthen URLs.



creates an object. Optionally you can pass an array of services to check if you want some more speed.


takes a (probably shortened) URL and find a longer URL. If not found, just returns the original URL.


takes a hash whose keys are service names and whose values are regexen to see if the tried URL should belong to the service or not. Preferably we should exclude API URLs but usually it doesn't matter as nothing would happen if we just GET them.

Several shorten services use special techniques to resolve links, such as multiple redirection or page refreshing. WWW::Lengthen doesn't support them natively at the moment, but if there's WWW::Shorten subclass, you can use it to lengthen like this:

  $self->add( Name => [ qr{^}, 'WWW::Shorten::ServiceName' ] );


returns an LWP::UserAgent object used internally.



0rz (
Metamark (
SnipURL (
TinyURL (
Snurl ( ( ( (
urlchen (
google (

Require WWW::Shorten subclasses

Shorl (




Kenichi Ishigaki, <>


Copyright (C) 2007 by Kenichi Ishigaki.

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