NAME
Object::KVC::Index - Object::KVC::Hash attribute grouping
SYNOPSIS
use Object::KVC;
my $list = Object::KVC::List->new();
my $object1 = Object::KVC::Hash->new();
my $object2 = Object::KVC::Hash->new();
$object1->set( "id", Object::KVC::String->new("id1234") );
$object2->set( "id", Object::KVC::String->new("id1234") );
.
.
.
More $object attributes
$list->add($object1);
$list->add($object2);
my $index = Object::KVC::Index->new( $list );
$index->make_index( "id" );
my $set = $index->fetch( "id" );
# $set is a Object::KVC::Set containing $object1 and $object2
DESCRIPTION
Object::KVC::Index groups Object::KVC::Hash objects having one or more identical attributes (key/value pairs) into Object::KVC::Sets.
The Object::KVC::Sets set objects can then be looked up using the string value of the value in each property.
METHODS
new()
The constructor. An Object::KVC::List must be provided.
$index = Object::KVC::Index->new( $list<Object::KVC::List> );
make_index( "key1", "key2", "key3" ... )
All objects in the supplied $list, with equal values for the specified keys, will be grouped into an Object::KVC::Set.
Objects without the specified property/key will be skipped.
$index->make_index( "key1", "key2", "key3" );
fetch()
Return the Object::KVC::Set of objects having the specified values.
$set = $index->fetch( "value1", "value2", "value2" );
COPYRIGHT AND LICENCE
Object::KVC::Index Copyright (C) 2012 Trystan Johnson
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.