blib/lib/Search/GIN/Extract/ClassMap/Like.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 45 CC 3 SCAR 16.7
CC
3
Cov
0%
matches
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 5.3
1 use 5.006; # our
2 use strict;
3 use warnings;
4  
5 package Search::GIN::Extract::ClassMap::Like;
6  
7 # ABSTRACT: Map Extractors based on what an objects inheritance or roles
8  
9 our $VERSION = '1.000002';
10  
11 our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
12  
13 use Moose qw( with blessed );
14 use namespace::autoclean;
15  
16 with 'Search::GIN::Extract::ClassMap::Role';
17  
18 no Moose;
19 __PACKAGE__->meta->make_immutable;
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34 sub matches {
35 my ( $self, $extractee ) = @_;
36 my @m;
37 return @m if not blessed $extractee;
38 for my $class ( $self->classmap_entries ) {
39 if ( $extractee->isa($class) or $extractee->does($class) ) {
40 push @m, $self->classmap_get($class);
41 }
42 }
43 return @m;
44 }
45  
46 1;
47  
48 __END__
49  
50 =pod
51  
52 =encoding UTF-8
53  
54 =head1 NAME
55  
56 Search::GIN::Extract::ClassMap::Like - Map Extractors based on what an objects inheritance or roles
57  
58 =head1 VERSION
59  
60 version 1.000002
61  
62 =head1 METHODS
63  
64 =head2 C<matches>
65  
66 # List of Search::GIN::Extract objects
67 my ( @extractors ) = $like_object->matches( $extractee );
68  
69 returns a list of extractors that are in the map for the object.
70  
71 for my $extractor ( @extractors ) {
72 my $metadata = $extractor->extract_values( $extractee );
73 }
74  
75 =head1 AUTHOR
76  
77 Kent Fredric <kentnl@cpan.org>
78  
79 =head1 COPYRIGHT AND LICENSE
80  
81 This software is copyright (c) 2015 by Kent Fredric <kentfredric@gmail.com>.
82  
83 This is free software; you can redistribute it and/or modify it under
84 the same terms as the Perl 5 programming language system itself.
85  
86 =cut