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:
- Index.pl now has jQuery powered Ajax expand and shrink URL functions.
- Index.pl (in the shorten function) now validates as the user types and uses the page (using chksc.pl and getsc.pl)
- 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.


about 5 months ago
OK, but link to download is missing. Delete this message when you have it.
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.
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.
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.