Julien Sobrier > WWW-Shorten-Safe > WWW::Shorten::Safe

Download:
WWW-Shorten-Safe-1.22.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.22   Source  

NAME ^

WWW::Shorten::Safe - Interface to shortening URLs using http://safe.mn/, http://clic.gs/, http://go2.gs/ or http://cliks.fr/.

VERSION ^

1.22

SYNOPSIS ^

WWW::Shorten::Safe provides an easy interface for shortening URLs using http://safe.mn/, http://clic.gs/, http://go2.gs/ or http://cliks.fr/.

    use WWW::Shorten::Safe;

    my $url = "http://www.example.com/";

    my $short = makeashorterlink($url);
    my $long = makealongerlink($short); # "http://www.example.com/"

or

    use WWW::Shorten::Safe;

    my $url = "http://www.example.com";
    my $safe = WWW::Shorten::Safe->new();

    $safe->shorten(URL => $url);
    print "shortened URL is $safe->{safeurl}\n";

    $safe->expand(URL => $safe->{safeurl});
    print "expanded/original URL is $safe->{longurl}\n";

    my $info = $safe->info(URL => $safe->{safeurl});
    print "number of clicks: ", $info->{clicks}, "\n";

FUNCTIONS ^

new

Create a new safe.mn object.

    my $safe = WWW::Shorten::Safe->new();

Arguments

source

Optional. User-Agent value.

    my $safe = WWW::Shorten::Safe->new(source => 'MyLibrary');

default: perlteknatussafe

domain

Optional. Domain of the short URL. Choose between safe.mn, clic.gs, go2.gs or cliks.fr.

    my $safe = WWW::Shorten::Safe->new(domain => 'clic.gs');

default: safe.mn

makeashorterlink(url[, domain])

The function makeashorterlink will call the safe.mn API site passing it your long URL and will return the shorter safe.mn version.

Arguments

url

Required. Long URL to shorten

    my $short = makeashorterlink("http://www.example.com/"); # http://safe.mn/25

domain

Optional. Domain of the short URL. Choose between safe.mn, clic.gs, go2.gs or cliks.fr.

    my $short = makeashorterlink("http://www.example.com/", "clic.gs"); # http://clic.gs/25

safe.mn by default

makealongerlink(url)

The function makealongerlink does the reverse. makealongerlink will accept as an argument the full safe.mn/clic.gs/go2.gs/cliks.fr URL.

If anything goes wrong, then the function will return undef.

Arguments

url

Required. Short URL to shorten

    my $long = makealongerlink("http://clic.gs/25"); # "http://www.example.com/"

shorten

Shorten a URL using http://safe.mn/, http://clic.gs/, http://go2.gs/ or http://cliks.fr/. Calling the shorten method will return the shortened URL but will also store it in safe.mn object until the next call is made.

    my $url = "http://www.example.com/";
    my $shortstuff = $safe->shorten(URL => $url);

    print "safeurl is " . $safe->{safeurl} . "\n";
or
    print "safeurl is $shortstuff\n";

Arguments

URL

Required. Long URL to shorten

    my $short = $safe->shorten(URL => "http://www.example.com/"); # http://safe.mn/25

DOMAIN

Optional. Domain of the short URL. Choose between safe.mn, clic.gs, go2.gs or cliks.fr.

    my $short = $safe->shorten(URL => "http://www.example.com/", DOMAIN => "clic.gs"); # http://clic.gs/25

safe.mn by default

expand

Expands a shortened safe.mn URL to the original long URL.

Arguments

URL

Required. Long URL to shorten

    my $long = $safe->expand(URL => "http://safe.mn/25"); # http://www.example.com/

info

Get information bout a short link.

Arguments

URL

Required. Short URL to track

    my $info = $safe->info(URL => "http://safe.mn/25");
    print "number of clicks: ", $info->{clicks}, "\n";

See http://safe.mn/api-doc/protocol#track-response for the list of fields returned: clicks, referers, countries, filetype, etc.

version

Gets the module version number

AUTHOR ^

Julien Sobrier, <jsobrier at safe.mn>

BUGS ^

Please report any bugs or feature requests to jsobrier at safe.mn.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc WWW::Shorten::Safe

You can also look for information at:

ACKNOWLEDGMENTS ^

Dave Cross for WWW::Shorten. .

COPYRIGHT & LICENSE ^

Copyright (c) 2009 Julien Sobrier, All Rights Reserved http://safe.mn/.

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

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 LICENSE, 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.

SEE ALSO ^

perl, WWW::Shorten, http://safe.mn/tools/#api.

syntax highlighting: