Bug 6679 - [SIGNED-OFF] fix 3 perlcritic violations in C4/Items.pm
[koha.git] / Koha / SuggestionEngine / Base.pm
1 package Koha::SuggestionEngine::Base;
2
3 # Copyright 2012 C & P Bibliography Services
4 #
5 # This file is part of Koha.
6 #
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
10 # version.
11 #
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20 =head1 NAME
21
22 Koha::SuggestionEngine::Base - Base class for SuggestionEngine plugins
23
24 =head1 SYNOPSIS
25
26   use base qw(Koha::SuggestionEngine::Base);
27
28 =head1 DESCRIPTION
29
30 Base class for suggestion engine plugins. SuggestionEngines must
31 provide the following methods:
32
33 B<get_suggestions (\%param)> - get suggestions for the search described
34 in $param->{'search'}, and return them in a hashref with the suggestions
35 as keys and relevance as values.
36
37 The following variables must be defined in each filter:
38   our $NAME ='Filter';
39   our $VERSION = '1.0';
40
41 These methods may be overriden:
42
43 B<initialize (%params)> - initialize the plugin
44
45 B<destroy ()> - destroy the plugin
46
47 These methods should not be overridden unless you are very sure of what
48 you are doing:
49
50 B<new ()> - create a new plugin object
51
52 =head1 FUNCTIONS
53
54 =cut
55
56 use strict;
57 use warnings;
58
59 use base qw(Class::Accessor);
60
61 __PACKAGE__->mk_ro_accessors(qw( name version ));
62 __PACKAGE__->mk_accessors(qw( params ));
63 our $NAME    = 'Base';
64 our $VERSION = '1.0';
65
66 =head2 new
67
68     my $plugin = Koha::SuggestionEngine::Base->new;
69
70 Create a new filter;
71
72 =cut
73
74 sub new {
75     my $class = shift;
76
77     my $self = $class->SUPER::new( {} );    #name => $class->NAME,
78                                             #version => $class->VERSION });
79
80     bless $self, $class;
81     return $self;
82 }
83
84 =head2 initialize
85
86     $plugin->initalize(%params);
87
88 Initialize a filter using the specified parameters.
89
90 =cut
91
92 sub initialize {
93     my $self   = shift;
94     my $params = shift;
95
96     #$self->params = $params;
97
98     return $self;
99 }
100
101 =head2 destroy
102
103     $plugin->destroy();
104
105 Destroy the filter.
106
107 =cut
108
109 sub destroy {
110     my $self = shift;
111     return;
112 }
113
114 =head2 get_suggestions
115
116     my $suggestions = $plugin->get_suggestions(\%param);
117
118 Return suggestions for the specified search.
119
120 =cut
121
122 sub get_suggestions {
123     my $self  = shift;
124     my $param = shift;
125     return;
126 }
127
128 1;