<%init> ## Verfiy we have a cookie with a _session_id my $j = Apache2::Cookie::Jar->new($r); my $c = $j->cookies('Dealermade'); unless ( defined $c ) { Dealermade::Error::nice_error($m, 'E201'); } ## Verify we have session that matches cookies ID my %APACHE_SESSION; eval { tie %APACHE_SESSION, 'Apache::Session::Postgres', $c->value, { Handle => $dbh, Commit => 1, }; }; if ( $@ ) { ## No tuple with matching ID (form cookie), bogus data. $dbh->rollback; Dealermade::Error::nice_error($m, 'E301'); } $S = \%APACHE_SESSION; ## Verify that the sessioned user still has an entry in the users table ## Save user information into $U by ref $U = $dbh->selectrow_hashref( q{ SELECT * FROM users WHERE pkid = ? }, {}, $APACHE_SESSION{'pkid'} ); if ( defined $U ) { delete $U->{'password'}; } else { $dbh->rollback; Dealermade::Error::nice_error($m, 'E501'); }