NAME

WWW::Google::URLShortener - Interface to Google URL Shortener API.

VERSION

Version 0.01

DESCRIPTION

The Google URL Shortener at goo.gl is a service that takes long URLs and squeezes them into fewer characters to make a link that is easier to share, tweet, or email to friends. Currently it supports version v1.

IMPORTANT: The version v1 of the Google Buzz API is in Labs, and its features might change unexpectedly until it graduates.

CONSTRUCTOR

The constructor expects your application API, which you can get it for FREE from Google.

use strict; use warnings;
use WWW::Google::URLShortener;

my $api_key = 'Your_API_Key';
my $google  = WWW::Google::URLShortener->new($api_key);

METHODS

shorten_url()

Returns the shorten url for the given long url as provided by Google URL Shortener API. This method expects one scalar parameter i.e. the long url.

use strict; use warnings;
use WWW::Google::URLShortener;

my $api_key = 'Your_API_Key';
my $google  = WWW::Google::URLShortener->new($api_key);
print $google->shorten_url('http://www.google.com');

expand_url()

Returns the expaned url for the given long url as provided by Google URL Shortener API. This method expects one scalar parameter i.e. the short url.

use strict; use warnings;
use WWW::Google::URLShortener;

my $api_key = 'Your_API_Key';
my $google  = WWW::Google::URLShortener->new($api_key);
print $google->expand_url('http://goo.gl/fbsS');

get_analytics()

Returns the analytics for the given short url as provided by Google URL Shortener API in the XML format. This method expects one scalar parameter i.e. the short url.

use strict; use warnings;
use WWW::Google::URLShortener;

my $api_key = 'Your_API_Key';
my $google  = WWW::Google::URLShortener->new($api_key);
print $google->get_analytics('http://goo.gl/fbsS');

AUTHOR

Mohammad S Anwar, <mohammad.anwar at yahoo.com>

BUGS

Please report any bugs or feature requests to bug-www-google-urlshortener at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Google-URLShortener. 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 WWW::Google::URLShortener

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright 2011 Mohammad S Anwar.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

DISCLAIMER

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.

See http://dev.perl.org/licenses/ for more information.