sub new { my $proto=shift; my $class=ref($proto) || $proto; my $myself; my $db; my $session; my $myCGI; my $sid; my $cookie ; my $dbh; #my object that contains a dbi handler $db = DatosUach::new($datos{HOST},$datos{DRIVER},$datos{DATABASE},$datos{USUARIO},$datos{PASSWORD}); #direct instance of DBI $dbh = DBI->connect(dbi:$datos{DRIVER}:dbname=$datos{DATABASE};host=$datos{HOST}, $datos{USUARIO},$datos{PASSWORD}); if ( !defined $dbh ) { die "Cannot connect to database!\n"; } print header. "checando:"; print "

REF=---".ref($db->{dbh})."---

"; print "checando el otro". ref($dbh); my $DBIHandler = $db->{dbh}; $DBIHandler->do("insert into sessions values ('1','1')"); print "Checando".ref ($DBIHandler); $CGI::POST_MAX =1024 * 25; $myCGI = new CGI; $sid = $myCGI->cookie("CGISESSID") || undef; #print header.$sid; if (defined $sid) { $session = new CGI::Session("driver:PostgreSQL", $sid, {Handle=>$db->{dbh}}); print header."Existe Sid" ; }else{ $session = new CGI::Session("driver:PostgreSQL", undef, {Handle=>$db->{dbh}}); $cookie = $myCGI->cookie(CGISESSID => $session->id); $sid = $session->id; print $myCGI->header( -cookie=>$cookie ); print "No existe sid"; }