imcsk8 has asked for the wisdom of the Perl Monks concerning the following question:
thanks for your helpsub 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{D +ATABASE},$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 "<h1>REF=---".ref($db->{dbh})."---</h1>"; 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, {H +andle=>$db->{dbh}}); $cookie = $myCGI->cookie(CGISESSID => $session->id); $sid = $session->id; print $myCGI->header( -cookie=>$cookie ); print "No existe sid"; }
Edit by castaway, extra empty lines removed
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: weird reference problem
by japhy (Canon) on Sep 02, 2004 at 21:19 UTC | |
by imcsk8 (Pilgrim) on Sep 02, 2004 at 22:25 UTC | |
|
Re: weird reference problem
by macPerl (Beadle) on Jan 19, 2005 at 15:52 UTC |