3 # Copyright ByWater Solutions 2015
5 # This file is part of Koha.
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 3 of the License, or (at your option) any later
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.
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.
27 use Koha::Z3950Responder;
31 z3950_responder.pl [-h|--help] [--man] [-a <pdufile>] [-v <loglevel>] [-l <logfile>] [-u <user>]
32 [-c <config>] [-t <minutes>] [-k <kilobytes>] [-d <daemon>] [-p <pidfile>]
33 [-C certfile] [-zKiDST1] [-m <time-format>] [-w <directory>] [--debug]
34 [--add-item-status=SUBFIELD] [--prefetch=NUM_RECORDS]
43 Prints a brief usage message and exits.
47 Displays manual page and exits.
51 Turns on debug logging to the screen, and turns on single-process mode.
53 =item B<--add-item-status=SUBFIELD>
55 If given, adds item status information to the given subfield.
57 =item B<--add-status-multi-subfield>
59 With the above, instead of putting multiple item statuses in one subfield, adds a subfield for each
62 =item B<--prefetch=NUM_RECORDS>
64 Number of records to prefetch from Zebra. Defaults to 20.
70 The item status strings added by B<--add-item-status> can be configured with the B<Z3950_STATUS>
71 authorized value, using the following keys:
95 my $add_item_status_subfield;
96 my $add_status_multi_subfield;
104 my ( $opt_name, $opt_value ) = @_;
106 push @yaz_options, "-$opt_name", "$opt_value";
112 '--debug' => \$debug,
113 '--add-item-status=s' => \$add_item_status_subfield,
114 '--add-status-multi-subfield' => \$add_status_multi_subfield,
115 '--prefetch=i' => \$prefetch,
116 # Pass through YAZ options.
117 'a=s' => \&add_yaz_option,
118 'v=s' => \&add_yaz_option,
119 'l=s' => \&add_yaz_option,
120 'u=s' => \&add_yaz_option,
121 'c=s' => \&add_yaz_option,
122 't=s' => \&add_yaz_option,
123 'k=s' => \&add_yaz_option,
124 'd=s' => \&add_yaz_option,
125 'p=s' => \&add_yaz_option,
126 'C=s' => \&add_yaz_option,
127 'm=s' => \&add_yaz_option,
128 'w=s' => \&add_yaz_option,
129 'z' => \&add_yaz_option,
130 'K' => \&add_yaz_option,
131 'i' => \&add_yaz_option,
132 'D' => \&add_yaz_option,
133 'S' => \&add_yaz_option,
134 'T' => \&add_yaz_option,
135 '1' => \&add_yaz_option
138 pod2usage(1) if $help;
139 pod2usage( -verbose => 2 ) if $man;
141 # Create and start the server.
143 die "This tool only works with Zebra" if C4::Context->preference('SearchEngine') ne 'Zebra';
145 my $z = Koha::Z3950Responder->new( {
146 add_item_status_subfield => $add_item_status_subfield,
147 add_status_multi_subfield => $add_status_multi_subfield,
149 num_to_prefetch => $prefetch,
150 yaz_options => [ @yaz_options, @ARGV ],