#!/usr/bin/perl
# generate a shitload of tiny urls

use Time::HiRes qw(usleep);
use WWW::Shorten::TinyURL qw(makeashorterlink);
use strict;

my($file, $base, $count, $tiny);
$file = $ARGV[0] || '/usr/share/dict/words';
$base = $ARGV[1] || 'http://tinyurl.com/poop/';
$count = 0;

open(RAND, "/usr/games/random -f $file |");
while(chomp($_ = <RAND>)) {
	$tiny = makeashorterlink($base . $_);
	print "${base}$_ => $tiny (" . ++$count . ")\n";
	usleep(400+rand(800));
}
close(RAND);

exit 0;
