Perl URL Shortener

This is the culmination of a couple hours of work started on Friday (the 22nd of January) night. It’s near feature complete, and fully functional. Take a look!

Files: (save as .pl file to run it.) **This code was last tested/updated on March 15, 2010, updated from original code posted here**

So far there have been a lot of changes as follows:

  1. Index.pl now has jQuery powered Ajax expand and shrink URL functions.
  2. Index.pl (in the shorten function) now validates as the user types and uses the page (using chksc.pl and getsc.pl)
  3. As a user types the text inputs on Index.pl will change from green (all good) to red (invalid URL, taken short code, etc…)

Future features include:

  • Home page view tracking
  • Per-user stats and information
  • Pagination of views and URLs on list.pl
  • A better stats.pl page
  • Better, more server friendly Ajax scripting
  • Better short code generation
  • New CSS
  • Some new statistics information (ex: per-domain short codes, views)
  • XML output
  • Use “nofollow” links on the list, stats pages

What do you think?

FWIW this code is free for you to use, however if you use or modify this code please do it with attribution and submit changes to be shared among anyone interested.

This code is available without warranty or guarantee.

Google Buzz

Post to Twitter Post to Delicious Post to Digg Post to Ping.fm Post to Reddit Post to StumbleUpon

  • #1 written by Louis
    about 5 months ago

    OK, but link to download is missing. Delete this message when you have it.

  • #2 written by bradarsenault
    about 5 months ago

    Thanks :-) I tested all of the links and they all work now. But I haven't pushed my latest changes to this code — like some Ajax and whatnot, but those will be here later today.

  • #3 written by Louis
    about 5 months ago

    It looks like a nice code, but I think MySQL definition is missing.

    I will probably not use this one, just looking into it. I have to make Shortener for myself, for my own URLs.

    I see you base URLs on a random password. And I was thinking to base them on some kind of short checksum instead.

  • #4 written by JLouisBiz
    about 5 months ago

    I found that Integer::Tiny provides short code for integer numbers, and if links are sorted by its ID, that can be used for short URL.

    I have to make service for myself, which has no user interface, but just link shortening.

Comments are closed.

blog comments powered by Disqus
Get Adobe Flash playerPlugin by wpburn.com wordpress themes