Data::Walk::Extracted
An extracted dataref walker
Purpose
This module takes a data reference (or two) and recursivly travels through it(them). Where the two references diverge the walker follows the primary data reference. At the beginning and end of each branching node the code will attempt to call a method on a passed object instance with data from the current location of the node. This module is largely useless without that additional functionality provided by the object instance. Both Data::Dumper - Dump and YAML - Dump functions are more mature than Data::Walk::Print function included here.
The module uses Carp to carp and croak so the variable $Carp::Verbose can be set for debugging. There are no attributes used to maintain data in this module so each recursive level creates its own view of itself. Beware! recursive parsing is not a good fit for all data since very deep data structures will burn a fair amount of perl memory! Meaning that as the module recursively parses through the levels perl leaves behind snapshots of the previous level that allow perl to keep track of it's location.
This is an implementation of the concept of extracted data walking from Higher-Order-Perl Chapter 1 by Mark Jason Dominus. The book is well worth the money! With that said this is object oriented code not functional code and is both written in Moose and the code expects an object instance (does not have to be a Moose class) to be available at the appropriate places for action. The MJD equivalent is written in the functional style and expects a passed CodeRef at the action points. There is clearly some overhead associated with both Moose and the object oriented style choices. Those choices are intentional on my side and should not be attributed to MJD.
Install from Source
(for example git)
- 1. Download a compressed file with the code
- 2. Extract the code from the compressed file
- 3. cd into the extracted directory
(For Windows find what version of make was used to compile your perl)
perl -V:make
Then
perl Makefile.PL
make
make test
make install
make clean