I've been dealing with forms for well over two years and I am still very happy doing manual checks on data, without any module help. You simply create a subroutine that outputs your form and do something like the following:

# login.pl: #!c:/perl/bin/perl -w $|++; use CGI::Simple; use Template; my $CGI = CGI::Simple->new; my $TMPL = Template->new( { INCLUDE_PATH => '/path/to/templates' } ); my $user = $CGI->param('user') || ''; my $pass = $CGI->param('pass') || ''; form_login('Please enter your member ID and password:') if ( ($user eq '') || ($pass eq '') ); form_login('Invalid member ID/password combination.') unless ( some_auth_method($user, $pass) ); # authentication successfull auth_successfull(do => 'something', now => 'please'); sub form_login { my ($usermsg) = @_; print $CGI->header(); # $TMPL->process('login.tmpl', { $TMPL->process(\*DATA, { $CGI->Vars(' '), title => 'Member Login', usermsg => $usermsg } ); exit; } __DATA__ [% USE HTML %] [% INCLUDE header.tmpl %] <p>[% HTML.escape(usermsg) %]</p> <form action="/path/to/login.pl" method="post"> Member ID: <input type="text" name="user" value="[% HTML.escape(user) %]" size="20" maxlength="15" /><br /><br /> Password: <input type="password" name="pass" value="[% HTML.escape(pass) %]" size="20" maxlength="20" /><br /><br /> <input type="submit" value="login now" /> </form> [% INCLUDE footer.tmpl %]

In reply to Re: An Easier Way to Validate Forms by Anonymous Monk
in thread An Easier Way to Validate Forms by perleager

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.