The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::Seek - Search Complex Data Structures

VERSION

version 0.06

SYNOPSIS

use Data::Seek;

my $hash   = {...};
my $seeker = Data::Seek->new(data => $hash);
my $result = $seeker->search('*');

$result->data;

DESCRIPTION

Data::Seek is a module for traversing complex data structures. This module allows you to select specific node(s) in a hierarchical data structure using a criteria. A criteria is an expression consisting of one or more criterion. A criterion is the part of the criteria that is used to select node(s) to be returned in the result. Data::Seek is akin to Data::Dpath but with fewer features and a simple node selection syntax. Data::Seek node traversal is extremely fast, and it can throw exception objects which explain, in detail, why a search failed. This is very useful internally, and externally when processing foreign data structures where you need to provide detailed errors explaining how to resolve the missing or malformed data nodes. For more information on the underlying concepts, please see Data::Seek::Concepts.

ATTRIBUTES

cache

$seeker->cache;
$seeker->cache(1);

Encode the data structure and cache the result. Allows multiple queries to execute faster. Caching is disabled by default.

data

$seeker->data;
$seeker->data(Data::Seek::Data->new(...));

The data structure to be introspected, must be a hash reference, blessed or not, which defaults to or becomes a Data::Seek::Data object.

ignore

$seeker->ignore;
$seeker->ignore(1);

Bypass exceptions thrown when a criterion finds an unknown or invalid node in the data structure.

METHODS

my @criteria = ('id', 'person.name.*');
my $result   = $seeker->search(@criteria);

Prepare a search object to use the supplied criteria and return a result object. Introspection is triggered when the result object is enacted. See Data::Seek::Search::Result for usage information.

AUTHOR

Al Newkirk anewkirk@ana.io

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Al Newkirk.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.