Data::Type::Digger - digging types from data structures
use Data::Type::Digger; my $in_data = { ... }; my $out_data = dig( $in_data, do_scalar => { uc @_ } );
dig helps you to deal with deep data structores.
Instead of other modules this allow more clearly separation of processing for different types of nodes into different sub's.
This can be useful, if the procesing code is different for different types of nodes, or if nodes have their own methods to apply or something other like this.
If you looking for more simple and type-independent tool, then you may look on some similar packages. For example: Data::Rmap, Data::Dmap, Data::Traverse.
Instead, if you need to process something like this: dig( $in_data, do_my_unique_class => { shift->unique_class_method() }, do_some_other_class => ... ); this module will be more useful. Also this module provide depth limitation, unblessing and cloning with passing just a simple param
dig
Perform recursive digging required types from data structure my $out_data = dig( $in_data, %params ); in_data = source structure, required Params: # all param keys are optional do_all => coderef, function called for all nodes do_hash => coderef, function called for all hashref nodes do_array => coderef, function called for all arrayref nodes do_scalar => coderef, function called for all scalar nodes do_type => coderef, function called for all nodes with ref = 'type' unbless => 0 || 1, turn all blessed objects into simple hashrefs clone => 1, make all actions on cloned structure and save the source data max_deep => -1, int -1, undef (not limited) || int (limited to INT) depth of work max_deep_cut => 0 || 1, save or cut the data deeper then max_deep coderef assumes two params: node - value of current node key - name or index of parent_node (if parent node ref is hash or array) returns: new value of node
After installing, you can find documentation for this module with the perldoc command.
perldoc Data::Type::Digger
You can also look for information at:
RT, CPAN's request tracker (report bugs here) http://rt.cpan.org/NoAuth/Bugs.html?Dist=Data-Type-Digger AnnoCPAN, Annotated CPAN documentation http://annocpan.org/dist/Data-Type-Digger CPAN Ratings http://cpanratings.perl.org/d/Data-Type-Digger Search CPAN http://search.cpan.org/dist/Data-Type-Digger/
ANTONC <antonc@cpan.org>
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: L<http://www.perlfoundation.org/artistic_license_2_0>
perform digging data and do some actions on values
To install Data::Type::Digger, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Type::Digger
CPAN shell
perl -MCPAN -e shell install Data::Type::Digger
For more information on module installation, please visit the detailed CPAN module installation guide.