#Initiate the connection to the database my $dbh = DBI->connect("DBI:mysql:database=DATABASE;host=localhost", "USER","PASS",{'RaiseError' => 1}); #create a CGI instance my $cgi = new CGI; #Create the session #my $session = new CGI::Session("DBI:MySQL", undef, {Handle=>$dbh}); my $session = new CGI::Session(undef, $cgi, {Directory=>'/tmp'});