On Thu Jan 29 03:08:03 2015, PERLANCAR wrote:
Show quoted text> It would be nice if the documentation describes some use cases or
> reason for this module. Because normally one would just maintain the
> real data structure, and then when the JSON is needed it can just be
> encoded on the fly (and then cached, should performance is an issue).
I will admit, my use case is probably unusual. I'm using an ORM (UR, also on CPAN) to load objects from a DB which have an attribute that holds JSON. I'm deserializing it and passing the data structure to another bit of code that might or might not change some of the data. After the entire request is complete, the ORM saves only the changed objects' data back to the DB.
This way, the data structure is re-serialized only if it's changed, and the object's data is only written back to the DB if the it changes.
Would an equivalent DBIx::Class example be good enough?