Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
shorten urls with bitly without api
Perl
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bitly.pm
bitly_test.pl
readme.txt

readme.txt

#
# Peteris Krumins (peteris.krumins@gmail.com, twitter: @pkrumins)
# http://www.catonmat.net -- good coders code, great coders reuse
#

Shorten bitly urls without api, plus shorten to custom keywords, too!

Here is how to shorten a URL:

    use bitly;

    my $bitly = bitly->new('username', 'password');
    my $url = bitly->shorten('http://www.url.com');

    unless ($url) {
        say $bitly->{error};
    }
    else {
        say $url;
    }

Here is how to shorten a URL to a custom keyword:

    use bitly;

    my $bitly = bitly->new('username', 'password');
    my $url = bitly->shorten_custom(
        'http://www.url.com', 'XyzzY'
    );

    unless ($url) {
        say $bitly->{error};
    }
    else {
        say $url;
    }

That's it.

Something went wrong with that request. Please try again.