Kent Fredric

NAME

Search::GIN::Extract::ClassMap - Delegate Extraction based on class.

VERSION

version 0.01060817

SYNOPSIS

  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 array ref, or a coderef, which internally are typecasted to Search::GIN::Extract::Attributes and Search::GIN::Extract::Callback automatically.

WARNING

This is an early release, API is prone to change without much warning, but best attempts will be made to avoid the need.

ROLES

Search::GIN::Extract

ATTRIBUTES

extract_isa

Applied on all objects where $object->isa( $classname );

types:

HashRef[ "Extractor" in Search::GIN::Extract::ClassMap::Types ] ->

"CoercedClassMap" in Search::GIN::Extract::ClassMap::Types ->

Search::GIN::Extract::ClassMap::Isa

HashRef's are automatically type-cast.

extract_does

Applied on all objects where $object->does( $classname );

types:

HashRef[ "Extractor" in Search::GIN::Extract::ClassMap::Types ] ->

"CoercedClassMap" in Search::GIN::Extract::ClassMap::Types ->

Search::GIN::Extract::ClassMap::Does

HashRef's are automatically type-cast.

extract_does

Applied on all objects where $object->does( $classname ) OR $object->isa( $classname );

this doesn't make complete sense, but its handy for lazy people.

types:

HashRef[ "Extractor" in Search::GIN::Extract::ClassMap::Types ]

"CoercedClassMap" in Search::GIN::Extract::ClassMap::Types ->

Search::GIN::Extract::ClassMap::Like

HashRef's are automatically type-cast.

METHODS

extract_values

for: Search::GIN::Extract

AUTHOR

Kent Fredric <kentnl@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Kent Fredric.

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




Hosting generously
sponsored by Bytemark