/usr/share/perl5/Search/GIN/Query/Manual.pm is in libsearch-gin-perl 0.11-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | use strict;
use warnings;
package Search::GIN::Query::Manual;
# ABSTRACT: Create manual GIN queries
our $VERSION = '0.11';
use Moose;
use namespace::autoclean;
with qw(
Search::GIN::Query
Search::GIN::Keys::Deep
);
has method => (
isa => "Str",
is => "ro",
predicate => "has_method",
);
has values => (
isa => "Any",
is => "ro",
required => 1,
);
has _processed => (
is => "ro",
lazy_build => 1,
);
has filter => (
isa => "CodeRef|Str",
is => "ro",
);
sub _build__processed {
my $self = shift;
return [ $self->process_keys( $self->values ) ];
}
sub extract_values {
my $self = shift;
my $EMPTY = q{};
return (
values => $self->_processed,
method => $self->has_method ? $self->method : $EMPTY,
);
}
sub consistent {
my ( $self, $index, $obj ) = @_;
if ( my $filter = $self->filter ) {
return $obj->$filter;
} else {
return 1;
}
}
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Search::GIN::Query::Manual - Create manual GIN queries
=head1 VERSION
version 0.11
=head1 SYNOPSIS
use Search::GIN::Query::Manual;
my $query = Search::GIN::Query::Manual->new(
values => {
name => 'Homer',
}
);
=head1 DESCRIPTION
Creates a manual GIN query that can be used to search records in a storage.
Unlike the stock GIN queries (L<Search::GIN::Query::Class>,
L<Search::GIN::Query::Attributes>), with this object you define your search
manually, allowing you to create any search you want.
=head1 METHODS/SUBROUTINES
=head2 new
Creates a new query.
=head1 ATTRIBUTES
=head2 values
The keys and values to build the query for.
=head1 AUTHOR
יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2008 by יובל קוג'מן (Yuval Kogman), Infinity Interactive.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|