Data::Locations 5.4 reviewDownload
Data::Locations - magic insertion points in your data Did you already encounter the problem that you had to produce some data in a
Data::Locations - magic insertion points in your data
Did you already encounter the problem that you had to produce some data in a particular order, but that some piece of the data was still unavailable at the point in the sequence where it belonged and where it should have been produced?
Did you also have to resort to cumbersome and tedious measures such as storing the first and the last part of your data separately, then producing the missing middle part, and finally putting it all together?
In this simple case, involving only one deferred insertion, you might still put up with this solution.
But if there is more than one deferred insertion, requiring the handling of many fragments of data, you will probably get annoyed and frustrated.
You might even have to struggle with limitations of the file system of your operating system, or handling so many files might considerably slow down your application due to excessive file input/output.
And if you don't know exactly beforehand how many deferred insertions there will be (if this depends dynamically on the data being processed), and/or if the pieces of data you need to insert need additional (nested) insertions themselves, things will get really tricky, messy and troublesome.
In such a case you might wonder if there wasn't an elegant solution to this problem.
This is where the "Data::Locations" module comes in: It handles such insertion points automatically for you, no matter how many and how deeply nested, purely in memory, requiring no (inherently slower) file input/output operations.
(The underlying operating system will automatically take care if the amount of data becomes too large to be handled fully in memory, though, by swapping out unneeded parts.)
Moreover, it also allows you to insert the same fragment of data into SEVERAL different places.
This increases space efficiency because the same data is stored in memory only once, but used multiple times.
Potential infinite recursion loops are detected automatically and refused.
In order to better understand the underlying concept, think of "Data::Locations" as virtual files with almost random access: You can write data to them, you can say "reserve some space here which I will fill in later", and continue writing data.
And you can of course also read from these virtual files, at any time, in order to see the data that a given virtual file currently contains.
When you are finished filling in all the different parts of your virtual file, you can write out its contents in flattened form to a physical, real file this time, or process it otherwise (purely in memory, if you wish).
You can also think of "Data::Locations" as bubbles and bubbles inside of other bubbles. You can inflate these bubbles in any arbitrary order you like through a straw (i.e., the bubble's object reference).
Note that this module handles your data completely transparently, which means that you can use it equally well for text AND binary data.
You might also be interested in knowing that this module and its concept have already been heavily used in the automatic code generation of large software projects.
What's New in This Release:
Fixed test file "02___refcount.t" to auto-adjust the offset dealing with self-ties not incrementing
the refcount in some Perl versions.
Added a warning to "Makefile.PL" that Perl versions including and between v5.6.1 and v5.7.0 are not fully supported (test file "11_______dump.t" dumps core).
Data::Locations 5.4 keywords