Re: only reading objects
[email protected] (Yuval Kogman) Sat, 26 Jan 2013 21:34:54 +0200
| Newsgroups | perl.kiokudb |
|---|---|
| Message-ID | <CAAQdECAq53Wo8k1MCsoXXpXcUskrgFCR6FVmcVZnBdrHeHbp2g@mail.gmail.com> |
--bcaec553ff389ac5fe04d436242e Content-Type: text/plain; charset=UTF-8 KiokuDB can work for your application. The plain file system storage backend should work for what you'd like. We've used this approach before and it has some advantages and disadvantages, namely it's pretty easy to create a configuration object system with lots of complexity to help remove the extra work from the core of the app, and even write a few scripts to update it in an orderly way. It's also OK-ish to edit the database by hand if it's JSON but it gets to be a pain to navigate all the separate files. There's KiokuX app whose name I forget that lets you connect to a DB and edit it with a web interface. Also keep in mind this is a big chunk of code/functionality for someone new to learn, so it might not be a time saver in the long run if you need to go back to something more traditional or if you need to explain what's going on to someone. If you're using KiokuDB in your app for other reasons I guess that gets mitigated, but it sounds like it might be a bit overkill for what you want. I wouldn't reccomend MooseX::Storage exactly for the reason you cite, also it's a little bit of an all-or-nothing type thing, if you need to do something out of its capabilities it can be tough. At any rate, for KiokuDB to write to disk you have to tell it to do so explicitly by using ->store or ->update on the fetched objects. The system will then scan through the working memory copy, and write the new data to disk. On 26 January 2013 19:22, Erik Colson <[email protected]> wrote: > Hi, > > I have a Moose app where I need to load objects from a file @ startup, > work on the objects _without_ modifying the file on disk. Preferably the > file should be JSON formatted. > > I've been reading the docs of KiokuDB and as far as my objects concern, > everything should load fine. However I think KiokuDB is made to get a > transparent persistence of data and therefor changing objects in memory > can also modify stuff on the disk.. > > Hence my question: Is KiokuDB a correct choice for my app or should I > use MooseX::Storage which has the pitfall of recreating lots of objects > instead of tracing the references... > > thanks > -- > erik > --bcaec553ff389ac5fe04d436242e--