Search::GIN::Extract::ClassMap - Delegate Extraction based on class.
version 1.000003
my $extractor = Search::GIN::Extract::ClassMap->new( extract_isa => { 'Foo' => [qw( bar baz quux )], 'Bar' => Search::GIN::Extract::AttributeIndex->new(), 'Baz' => sub { shift; my $object = shift; { a => $object->a() } }, }, extract_does => { }, extract => { /* either ISA or DOES */ }, );
In reality, the form is more like this:
my $extractor = Search::GIN::Extract::ClassMap->new( extract_isa => { 'Foo' => Search::GIN::Extract::*, 'Bar' => Search::GIN::Extract::*, 'Baz' => Search::GIN::Extract::*, }, extract_does => { }, extract => { /* either ISA or DOES */ }, );
With the minor exception of the 2 exception cases, passing an ArrayRef, or a CodeRef, which internally are type-cast to Search::GIN::Extract::Attributes and Search::GIN::Extract::Callback automatically.
ArrayRef
CodeRef
Search::GIN::Extract::Attributes
Search::GIN::Extract::Callback
This is an early release, API is prone to change without much warning, but best attempts will be made to avoid the need.
API
This module is an extension for the Search::GIN framework providing a novel way to dictate which attribute extraction techniques will be used for which object by having rules that map against the objects inheritance or the objects composed roles.
Search::GIN
This essentially permits you to register adapters for various object types to special-case their extraction.
For example, if you had a source tree that used classes under your control using MooseX::AttributeIndexes, you could easily default those classes to extract using Search::GIN::Extract::AttributeIndexes. And if any objects of those classes had DateTime properties, you could define a handler for extracting DateTime meta-data for indexing specifically.
MooseX::AttributeIndexes
Search::GIN::Extract::AttributeIndexes
DateTime
extract_values
my ( @values ) = $object->extract_values( $extractee );
for: Search::GIN::Extract
Search::GIN::Extract
Iterates the contents of the extract($|_\w+$) rules, and asks them to extract their respective information, and returns the resulting results as a list.
extract($|_\w+$)
extract_isa
my $object = Search::GIN::Extract::ClassMap->new( extract_isa => $isa_thing ); # or $object->extract_isa( $isa_thing )
Applied on all objects where $object->isa( $classname );
$isa_thing
HashRef[ Extractor ]
CoercedClassMap
::ClassMap::Isa
HashRef's are automatically type-cast.
HashRef
extract_does
my $object = Search::GIN::Extract::ClassMap->new( extract_does => $does_thing ); # or $object->extract_does( $does_thing );
Applied on all objects where $object->does( $classname );
$does_thing
::ClassMap::Does
extract
my $object = Search::GIN::Extract::ClassMap->new( extract => $like_thing ); # or $object->extract( $like_thing );
Applied on all objects where $object->does( $classname ) OR $object->isa( $classname );
this doesn't make complete sense, but its handy for lazy people.
$like_thing
::ClassMap::Like
Kent Fredric <kentnl@cpan.org>
This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Search::GIN::Extract::ClassMap, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Search::GIN::Extract::ClassMap
CPAN shell
perl -MCPAN -e shell install Search::GIN::Extract::ClassMap
For more information on module installation, please visit the detailed CPAN module installation guide.