Soon some monks are going to say use CGI or die; - and they'll be quite right, because I think many of the things you are doing cd be done quicker that way (and probably more robustly: I'd hazard that whatever mechanism creates %formdata is not an improvement on CGI.pm's data parsing).

I'd like to encourage you to use two other CPAN modules, however (and if you need encouragement to use modules in principle, I'd like to offer that too - the modest effort in learning to use them is immediately repaid; and in fact looking through the guts of a module is a great way to learn Perl from the best):

1 CGI::Carp - will put lots of useful error messages onto your browser and help you find where your code is going wrong:
use CGI qw/:standard/; # you already did this! use CGI::Carp qw(fatalsToBrowser warningsToBrowser); print header; # and now you have sent a print header warningsToBrowser(1);
2 HTML::Template. As far as I see, you are opening an html file, then going through it making changes to it and sending the changed data to the browser. A templating module does much the same. But a well-thought-through templating module (I think HTML::Template is good'un - there are others) will do this in a way that
  • offers lots of features you will find useful
  • cleans up your code
  • doesn't break when you try to do something new
  • "hides information" - in the good sense of putting bits of your programme inside a box where you know they're doing their job but you don't have to bother about how they do it - leaving you more brainpower to do your stuff.

    Oh... also you are putting a -w after your #! /usr/bin/perl and following it with use strict; ... I presume. If not, the monastery will afford you many good arguments for why. The main one is: they help you catch your mistakes before they grow out of control.

    § George Sherston

    In reply to Re: anyone have an answer? by George_Sherston
    in thread CGI hanging during HTML generation (was : anyone have an answer?) by emilford

    Title:
    Use:  <p> text here (a paragraph) </p>
    and:  <code> code here </code>
    to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.