On Fri, 8 Nov 2002, Chris wrote:

[snip]
> So this is what I add to my web scripts:
[snip]
> Thoughts?
[snip]

why modify FileStore?  does it make sense to escape/unescape arbitrary objects?
it does for FileStore since all it takes are Strings, but why bother for normal
object key/value?

i was thinking something like :

require 'cgi/session'
require 'pstore'

class CGI
  class Session
    class PStoreStore < FileStore
      def initialize cgi, options={}
	super
	@p = PStore.new @f.path
      end
      def restore
	@p.transaction do
	  begin
	    @hash = @p['hash']
	  rescue
	    @hash = {}
	  end
	end
	@hash
      end
      def update
	@p.transaction do
	    @p['hash'] = @hash
	end
      end
    end
  end
end

the other FileStore methods do not need to be overidden.

-a

-- 

 ====================================
 | Ara Howard
 | NOAA Forecast Systems Laboratory
 | Information and Technology Services
 | Data Systems Group
 | R/FST 325 Broadway
 | Boulder, CO 80305-3328
 | Email: ahoward / fsl.noaa.gov
 | Phone:  303-497-7238
 | Fax:    303-497-7259
 ====================================