Data::DRef is a Perl module that provides a streamlined interface for accessing values within nested Perl data structures. These structures are generally networks of hashes and arrays, some of which may be blessed into various classes, containing a mix of simple scalar values and references to other items in the structure.
The Data::DRef functions allow you to use delimited key strings to set and retrieve values at desired nodes within these structures. These functions are slower than direct variable access, but provide additional flexibility for high-level scripting and other late-binding behaviour. For example, a web-based application could use DRefs to simplify customization, allowing the user to refer to arguments processed by CGI.pm in fairly readable way, such as query.param.foo.
A suite of utility functions, previous maintained in a separate Data::Collection module, performs a variety of operations across nested data structures. Because the Data::DRef abstraction layer is used, these functions should work equally well with arrays, hashes, or objects that provide their own key-value interface.
SYNOPSIS
use Data::DRef qw( :dref_access );
my $hash = { 'items' => [ 'first' ] };
print get_value_for_dref($hash, 'items.0');
set_value_for_dref( $hash, 'items.1', 'second' );
set_value_for_root_dref( 'myhash', $hash );
print get_value_for_root_dref('myhash.items.0');
use Data::DRef qw( :select );
matching_keys($target, %filter_criteria) : $key or @keys
matching_values($target, %filter_criteria) : $item or @items
use Data::DRef qw( :index );
index_by_drefs($target, @drefs) : $index
unique_index_by_drefs($target, @drefs) : $index
ordered_index_by_drefs( $target, $index_dref ) : $entry_ary
use Data::DRef qw( :leaf );
leaf_drefs($target) : @drefs
leaf_values( $target ) : @values
leaf_drefs_and_values( $target ) : %dref_value_pairs
Product's homepage
Requirements:
· Perl