CGI::Shorten - Creating your shortened links


CGI-Shorten documentation  | view source Contained in the CGI-Shorten distribution.

Index


NAME

Top

CGI::Shorten - Creating your shortened links

SYNOPSIS

Top

This module may help you to build a personal shortening-link service. Feeding the long, verbose, and tedious url, it can return you a shortened one. And it can also print out redirection header in you CGI script.

USAGE

Top

  use CGI::Shorten;

new

  $sh = new CGI::Shorten (
			  db_prefix => ".shorten_",
			  script_url => 'http://my.host/shorten.pl',
			  );

You need to specify the prefix of databases to the constructor and may specify the url of the script that does the shortening task. The script's url defaults to 'http://127.0.0.1/shorten.pl'

Return the shortened url

  print $sh->shorten($url);

return the original url

  print $sh->lengthen($url);

return the CGI redirection header

  print $sh->redirect($url);

If the redirected url does not exist, it will return 404 Not Found.

COPYRIGHT

Top


CGI-Shorten documentation  | view source Contained in the CGI-Shorten distribution.