Regarding the SQL query in duplicate_email(), unless there's a compelling need to return anything more than true or false, I'd change it to SELECT COUNT(*) FROM email WHERE email='$email'. Why make the database do more work than it needs, especially if you're returning the parameter you passed in if there are duplicates. :) (Hey, this isn't a big inefficiency unless you have an oustandingly large number of rows to return, but it's a good principle.)

Regarding Masem's suggestion for a dispatch table, instead of changing the function signatures for all of your subroutines, you can use anonymous subs:

my %functions = ( default => sub { write_default($script_loc) }, warning => sub { write_warning($script_loc, $email, $name, $warnin +g_msg) }, confirm => sub { write_confirm($script_loc, $email, $name) }, commit => sub { write_commit($email, $name) }, );
Ahh, closures.

Update: mischief caught a missing curly brace.


In reply to Re: First Perl CGI app; desirous of peer review. by chromatic
in thread First Perl CGI app; desirous of peer review. by legLess

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.