# 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 %]
[% HTML.escape(usermsg) %]
[% INCLUDE footer.tmpl %]