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 %]
|