in reply to HTML::Template and setting Cookies

Here is another example if this helps you... I had the same problem. CGI::App rules when you know how to use it but it is a love hate relationship :-)

sub Login
{
    # Local variables
    my $self = shift;
    my $cgi = $self->query();
    my $permissions = "";
    my $template;
	
    # Check the database for the username and password
    my $dbh = DBI->connect("DBI:mysql:$databaseName", $dbUser, $dbPass) or die "Could not connect to database: " . DBI->errstr;
    my $sth = $dbh->prepare('SELECT Users.permissions FROM Users WHERE username=? AND password=?');
    $sth->execute($cgi->param('username'), $cgi->param('password')) or die DBI->errstr;
	
    # see if the user was in the database
    if (my @permissions = $sth->fetchrow_array)
    {
        # They have a valid login. Get the template
        $template = $self->load_tmpl("loginVALID.html");
		
        # Make a cookie
        my $cookie = $cgi->cookie(-name => 'browserID',
                                  -value => '55',
                                  -expires => '+30m',
                                  -domain => 'dshack.com');
							  
	# Give the cookie to the browser		
        $self->header_props(-cookie => $cookie);								  
	# Set the redirect
        $template->param('redirect',cgi->param("redirect"));
    }
    else
    {
	# they do not have a valid login
	$template = $self->load_tmpl("login.html");

        # Display the Bad username and password warning	
        $template->param('INVALID', '1');
    }

    return $template->output;	
}
Hope this helps. -- RogueFalcon
Why do you people insist on doing things sdrawkcab?