From: Stephen Schaefer Date: 2002-02-09T06:17:46+09:00 Subject: Postgress backend for CGI::Session I'd like to contribute this original code, and would appreciate any critique. I've used it successfully in a re-implementation of the hangman program from ``Writing Apache Modules in Perl and C''. I am not convinced this code will scale, and I'd like to participate in a discussion of whether and how one would pre-declare the structure of an appropriate backend database. In PostgreSQL 6.5 I used ``varchar'' for the fields and field values; in PostgreSQL 7.1 I switch to ``text'' fields, since it would no longer cast ``varchar'' fields to integer or other numeric types. Anyway, the code: =begin = Synopsis require pgsession.rb aSession = CGI::Session.new( aCGI, 'database_manager' => CGI::Session::PostgreSQL, < aHash >* ) value = aSession[key] aSession[key] = value aSession.delete aSession.update = Description This file extends the class (({CGI::Session})) to support a PostgreSQL backend. It will be persistent in the same way that (({CGI::Session::FileStore})) is, but uses a postgres database named (({web})) with two tables defined as follows: #!/bin/sh /usr/bin/psql web <