PrePAN

Sign in to PrePAN

Profile

jkstill@github

GitHub: jkstill PAUSE ID: JKSTILL

User's Modules

Data::Ref Show access path items in deeply nested data structures

Data::Ref is used to show the complete path to all elements in a complex data structure consisting of Hash and/or Arrays.

Recently I have spent a fair bit of time manipulating some deeply nested JSON structures that have been read in via some JSON package. At times it has been difficult to determine the exact data path to any particular piece of data..

In addition to being deeply nested, the data is sometimes large, and there may be many elements in each object. The net result is this; it is quite difficult at times to determine the path to any particular element, as it is usually necessary to scroll through several screens of data.

I developed Data::Ref so that I can easily see how to reference any element appearing in the data.

The included demo scripts simply do one of the following: - read in a perl script that contains only data from an object, process with eval and then walk and display the paths to each element - much the same as previous, but read data from a JSON file

See test-files/tc03.pl for the test data.

Note: the standard Markdown code blocks are not behaving in the manner I would normally expect. I will add a short demo when I learn how to do it properly.

In the meantime, please see Data::Ref README.md which contains demos.

jkstill@github 0 comments