From: Ryan Pavlik Date: 2003-04-26T06:32:16+09:00 Subject: Re: Persistant data On Sat, 26 Apr 2003 05:43:03 +0900 Matt Lawrence wrote: > Ok, I've been looking at Marshal, PStore, Madelaine and mnemonic. None of > them seem to provide the simple and transparent mechanism that I'm looking > for. > > I'd like to be able to do something like: > > arr = PersistantArray.use("") > hash = PersistentHash.use("") > If you can hang on for a day or so, I'll release Mephle on Monday. I just added the ability to write non-networked apps a few nights ago, along with a SQLite storage driver. What's Mephle? Well, let's get to the part you want: s = String.new_on(:volume, "abc") What did this do? 's' is now a String object stored in the volume :volume (which is just a tag, see next), implicitly on $SERVER (more on that later). A volume is just a tag for a storage driver. You can add a SQLiteStorage, which stores everything in a single file. (Also included is MySQLStorage, which stores stuff in a MySQL db; useful for larger apps.) There is a "virtual directory" structure, so you can do this, too: s = String.new_on("/strings/my_string", :default, "abcd") Later, you can recover it by doing the following: s = retrieve("/strings/my_string", :default) The nice part is---just like you want---no worry about file formats, and it's all transparent. It's even better than PersistantArray, though, because _any_ given type can be persisted. (Marshal is used internally.) Of course, this is just a small portion of what Mephle provides; you also get nice network transparency: $C = Mephle::Driver::TCPConnection("remotehost.com", 9000) $C.open s = Get($C, :default, "/strings/my_string") Now 's' is a remote reference. It will act and behave exactly like a String, except any method calls happen on the remote object. Even exceptions will be thrown across the network. :-) There are other nifty things too, like class_ and method_info (code-accessible documentation), HTML widget library, automatic interface generation for objects, and others. (Don't worry, this is _not_ tied to HTML, but it does have extensive web interface support.) Interested? ;) -- Ryan Pavlik "These monkeys of which you speak... are they mentally deficient by human or monkey standards?" - 8BT