my $cgi = new CGI; # get the User my $user = new GWAK::User(); # did it work ? if (!$user) { # if not go to login page print $cgi->redirect("insert your login_url"); } else { # or proceed print $cgi->header(); ... }