| 1 | 3 | ▶ | use 5.006; # our | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | package Search::GIN::Extract::ClassMap::Like; | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | # ABSTRACT: Map Extractors based on what an objects inheritance or roles | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 3 | our $VERSION = '1.000002'; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 3 | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use Moose qw( with blessed ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 3 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 3 | with 'Search::GIN::Extract::ClassMap::Role'; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 3 | ▶ | no Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 3 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | sub matches { | ||||||||||||||||||||||||||||
| 35 | 2 | ▶ | my ( $self, $extractee ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
matches: called CC=5 SCAR=17.2
Pod
documented
| |||||||||||||||||||||||||||||
| 36 | 2 | my @m; | |||||||||||||||||||||||||||
| 37 | 2 | ▶ | return @m if not blessed $extractee; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | 2 | for my $class ( $self->classmap_entries ) { | |||||||||||||||||||||||||||
| 39 | 2 | ▶ | if ( $extractee->isa($class) or $extractee->does($class) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$extractee->isa($class) or $extractee->does($class)
MC/DC0%0/2
$extractee->isa($class) or $extractee->does($class)
$extractee->isa($class)
$extractee->does($class)
Truth table33%1/3
A or B
A= $extractee->isa($class)B= $extractee->does($class)
| |||||||||||||||||||||||||||||
| 40 | 2 | push @m, $self->classmap_get($class); | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | 2 | return @m; | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 3 | 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 | ||||||||||||||||||||||||||||