sub form { start_form; # This would be the first page they see when entering # the form for the first time, no param passed into # the subroutine at this point, first time entry if (!param) { Ask user for URL (param('url')); Ask user for Title (param('title')); Next/Reset form buttons; } # This would be the validation of the first form, which # is only shown when the elements in the first page # above are validated and completed if (param('url') && param('title') { validate input (only allow ftp, http, gopher) test that the URL is up (HEAD on url) retrieve Content-Type and Content-Length from url if (($url =~ /.pdf$/i) || ($url =~ /.doc$/i)) { if ($type =~ "pdf") { # turn into pdf:// URI syntax $url =~ s/^\w+/pdf/m; } elsif ($type =~ "doc") { # turn into doc:// URI syntax $url =~ s/^\w+/doc/m; } convert any spaces in 'title' to underscores } if (the first page was filled out and validated) { start_second_page_form Ask user for maxdepth to gather (param('maxdepth')) Ask user for heuristics on URL (param('ag')) Next/Back/Reset form buttons } # ...and so on }