#!/usr/bin/env perl use strict; use warnings; use Data::Random qw(:all); use Getopt::Long; use URI; GetOptions( "categories=i" => \my $cats, "max-resources=i" => \my $max, "min-resources=i" => \my $min ) or die "Error in command line arguments\n"; $cats ||= 3; $max ||= 7; $min ||= 2; die "min-resources cannot be higher than max-resources" if $min > $max; for my $cat ( 1 .. $cats ) { printf "# <%s>\n\n", join " ", map uc, rand_words( min => 1, max => 8 ); for ( 1 .. $min + rand($max-$min+1) ) { my $name = join " ", map ucfirst, rand_words( min => 1, max => 5 ); my @uri; push @uri, "www" if rand(1) > .5; push @uri, map lc, rand_words( min => 1, max => 3 ); push @uri, [qw/ com org co uk jp de nl /]->[rand 7] for 1 .. rand(2); my @path = map lc, rand_words( min => 0, max => 3 ); my @query = map lc, rand_words( min => 0, max => 6 ); pop @query if @query % 2; my $uri = URI->new( join("/", join(".", @uri), @path) ); $uri->query_form(@query); my $desc = ucfirst join " ", map lc, rand_words( min => 3, max => 9 ); printf "[%s] (%s) %s.\n\n", $name, $uri, $desc; } }