<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME
    MooseX::AttributeIndexes - Advertise metadata about your
    Model-Representing Classes to Any Database tool.

VERSION
    version 1.0.0

SYNOPSIS
  Implementing Indexes
      package My::Package;
      use Moose;
      use MooseX::AttributeIndexes;
      use MooseX::Types::Moose qw( :all );

      has 'id' =&gt; (
        isa =&gt; Str,
        is  =&gt; 'rw',
        primary_index =&gt; 1,
      );

      has 'name' =&gt; (
        isa =&gt; Str,
        is  =&gt; 'rw',
        indexed =&gt; 1,
      );

      has 'foo' =&gt; (
        isa =&gt; Str,
        is  =&gt; 'rw',
      );

  Accessing Indexed Data
      package TestScript;

      use My::Package;

      my $foo = My::Package-&gt;new(
        id =&gt; "Bob",
        name =&gt; "Smith",
        foo  =&gt; "Bar",
      );

      $foo-&gt;attribute_indexes
      # { id =&gt; 'Bob', name =&gt; 'Smith' }

  Using With Search::GIN::Extract::Callback
      Search::GIN::Extract::Callback(
        extract =&gt; sub {
          my ( $obj, $callback, $args ) = @_;
          if( $obj-&gt;does( 'MooseX::AttributeIndexes::Provider') ){
            return $obj-&gt;attribute_indexes;
          }
        }
      );

  CODERef
    Since 0.01001007, the following notation is also supported:

      has 'name' =&gt; (
        ...
        indexed =&gt; sub {
          my ( $attribute_meta, $object, $value ) = @_;
          return "$_" ; # $_ == $value
        }
      );

    Noting of course, $value is populated by the meta-accessor.

    This is a simple way to add exceptions for weird cases for things you
    want to index that don't behave like they should.

   SEE ALSO
    Search::GIN::Extract::AttributeIndexes

METHODS
  init_meta
    Injects the traits for Indexed as default traits on all new attributes,
    and glues the 2 magical roles into your package.

AUTHOR
    Kent Fredric &lt;kentnl@cpan.org&gt;

COPYRIGHT AND LICENSE
    This software is copyright (c) 2011 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.

</pre></body></html>