Documentation for logging facilities.
[ZOOM-Perl-moved-to-github.git] / lib / ZOOM.pod
1 # $Id: ZOOM.pod,v 1.27 2005-12-22 14:11:17 mike Exp $
2
3 use strict;
4 use warnings;
5
6 =head1 NAME
7
8 ZOOM - Perl extension implementing the ZOOM API for Information Retrieval
9
10 =head1 SYNOPSIS
11
12  use ZOOM;
13  eval {
14      $conn = new ZOOM::Connection($host, $port)
15      $conn->option(preferredRecordSyntax => "usmarc");
16      $rs = $conn->search_pqf('@attr 1=4 dinosaur');
17      $n = $rs->size();
18      print $rs->record(0)->render();
19  };
20  if ($@) {
21      print "Error ", $@->code(), ": ", $@->message(), "\n";
22  }
23
24 =head1 DESCRIPTION
25
26 This module provides a nice, Perlish implementation of the ZOOM
27 Abstract API described and documented at http://zoom.z3950.org/api/
28
29 the ZOOM module is implemented as a set of thin classes on top of the
30 non-OO functions provided by this distribution's C<Net::Z3950::ZOOM>
31 module, which in 
32 turn is a thin layer on top of the ZOOM-C code supplied as part of
33 Index Data's YAZ Toolkit.  Because ZOOM-C is also the underlying code
34 that implements ZOOM bindings in C++, Visual Basic, Scheme, Ruby, .NET
35 (including C#) and other languages, this Perl module works compatibly
36 with those other implementations.  (Of course, the point of a public
37 API such as ZOOM is that all implementations should be compatible
38 anyway; but knowing that the same code is running is reassuring.)
39
40 The ZOOM module provides two enumerations (C<ZOOM::Error> and
41 C<ZOOM::Event>), two utility functions C<diag_str()> and C<event()> in
42 the C<ZOOM> package itself, and eight classes:
43 C<ZOOM::Exception>,
44 C<ZOOM::Options>,
45 C<ZOOM::Connection>,
46 C<ZOOM::Query>,
47 C<ZOOM::ResultSet>,
48 C<ZOOM::Record>,
49 C<ZOOM::ScanSet>
50 and
51 C<ZOOM::Package>.
52 Of these, the Query class is abstract, and has three concrete
53 subclasses:
54 C<ZOOM::Query::CQL>,
55 C<ZOOM::Query::PQF>
56 and
57 C<ZOOM::Query::CQL2RPN>.
58 Finally, it also provides a
59 C<ZOOM::Query::Log>
60 module which supplies a useful general-purpose logging facility.
61 Many useful ZOOM applications can be built using only the Connection,
62 ResultSet, Record and Exception classes, as in the example
63 code-snippet above.
64
65 A typical application will begin by creating an Connection object,
66 then using that to execute searches that yield ResultSet objects, then
67 fetching records from the result-sets to yield Record objects.  If an
68 error occurs, an Exception object is thrown and can be dealt with.
69
70 More sophisticated applications might also browse the server's indexes
71 to create a ScanSet, from which indexed terms may be retrieved; others
72 might send ``Extended Services'' Packages to the server, to achieve
73 non-standard tasks such as database creation and record update.
74 Searching using a query syntax other than PQF can be done using an
75 query object of one of the Query subclasses.  Finally, sets of options
76 may be manipulated independently of the objects they are associated
77 with using an Options object.
78
79 In general, method calls throw an exception if anything goes wrong, so
80 you don't need to test for success after each call.  See the section
81 below on the Exception class for details.
82
83 =head1 UTILITY FUNCTIONS
84
85 =head2 ZOOM::diag_str()
86
87  $msg = ZOOM::diag_str(ZOOM::Error::INVALID_QUERY);
88
89 Returns a human-readable English-language string corresponding to the
90 error code that is its own parameter.  This works for any error-code
91 returned from
92 C<ZOOM::Exception::code()>,
93 C<ZOOM::Connection::error_x()>
94 or
95 C<ZOOM::Connection::errcode()>,
96 irrespective of whether it is a member of the C<ZOOM::Error>
97 enumeration or drawn from the BIB-1 diagnostic set.
98
99 =head2 ZOOM::event()
100
101 B<Warning.>
102 Lark's vomit.  Do not read this section.
103
104  $which = ZOOM::event([ $conn1, $conn2, $conn3 ]);
105
106 Used only in complex asynchronous applications, this function takes a
107 reference to a list of Connection objects, waits until an event
108 occurs on any one of them, and returns an integer indicating which of
109 the connections it occurred on.  The return value is a 1-based index
110 into the list; 0 is returned if no event occurs within the longest
111 timeout specified by the C<timeout> options of all the connections.
112
113 B<Warning.>
114 This function is not yet implemented.
115
116 =head1 CLASSES
117
118 The eight ZOOM classes are described here in ``sensible order'':
119 first, the four commonly used classes, in the he order that they will
120 tend to be used in most programs (Connection, ResultSet, Record,
121 Exception); then the four more esoteric classes in descending order of
122 how often they are needed.
123
124 With the exception of the Options class, which is an extension to the
125 ZOOM model, the introduction to each class includes a link to the
126 relevant section of the ZOOM Abstract API.
127
128 =head2 ZOOM::Connection
129
130  $conn = new ZOOM::Connection("indexdata.dk:210/gils");
131  print("server is '", $conn->option("serverImplementationName"), "'\n");
132  $conn->option(preferredRecordSyntax => "usmarc");
133  $rs = $conn->search_pqf('@attr 1=4 mineral');
134  $ss = $conn->scan('@attr 1=1003 a');
135  if ($conn->errcode() != 0) {
136     die("somthing went wrong: " . $conn->errmsg())
137  }
138  $conn->destroy()
139
140 This class represents a connection to an information retrieval server,
141 using an IR protocol such as ANSI/NISO Z39.50, SRW (the
142 Search/Retrieve Webservice), SRU (the Search/Retrieve URL) or
143 OpenSearch.  Not all of these protocols require a low-level connection
144 to be maintained, but the Connection object nevertheless provides a
145 location for the necessary cache of configuration and state
146 information, as well as a uniform API to the connection-oriented
147 facilities (searching, index browsing, etc.), provided by these
148 protocols.
149
150 See the description of the C<Connection> class in the ZOOM Abstract
151 API at
152 http://zoom.z3950.org/api/zoom-current.html#3.2
153
154 =head3 Methods
155
156 =head4 new()
157
158  $conn = new ZOOM::Connection("indexdata.dk", 210);
159  $conn = new ZOOM::Connection("indexdata.dk:210/gils");
160  $conn = new ZOOM::Connection("tcp:indexdata.dk:210/gils");
161  $conn = new ZOOM::Connection("http:indexdata.dk:210/gils");
162
163 Creates a new Connection object, and immediately connects it to the
164 specified server.  If you want to make a new Connection object but
165 delay forging the connection, use the C<create()> and C<connect()>
166 methods instead.
167
168 This constructor can be called with two arguments or a single
169 argument.  In the former case, the arguments are the name and port
170 number of the Z39.50 server to connect to; in the latter case, the
171 single argument is a YAZ service-specifier string of the form
172
173 =over 4
174
175 =item
176
177 [I<scheme>:]I<host>[:I<port>][/I<databaseName>]
178
179 =back
180
181 In which the I<host> and I<port> parts are as in the two-argument
182 form, the I<databaseName> if provided specifies the name of the
183 database to be used in subsequent searches on this connection, and the
184 optional I<scheme> (default C<tcp>) indicates what protocol should be
185 used.  At present, the following schemes are supported:
186
187 =over 4
188
189 =item tcp
190
191 Z39.50 connection.
192
193 =item ssl
194
195 Z39.50 connection encrypted using SSL (Secure Sockets Layer).  Not
196 many servers support this, but Index Data's Zebra is one that does.
197
198 =item unix
199
200 Z39.50 connection on a Unix-domain (local) socket, in which case the
201 I<hostname> portion of the string is instead used as a filename in the
202 local filesystem.
203
204 =item http
205
206 SRW connection using SOAP over HTTP.
207
208 =back
209
210 Support for SRU will follow in the fullness of time.
211
212 If an error occurs, an exception is thrown.  This may indicate a
213 networking problem (e.g. the host is not found or unreachable), or a
214 protocol-level problem (e.g. a Z39.50 server rejected the Init
215 request).
216
217 =head4 create() / connect()
218
219  $options = new ZOOM::Options();
220  $options->option(implementationName => "my client");
221  $conn = create ZOOM::Connection($options)
222  $conn->connect($host, 0);
223
224 The usual Connection constructor, C<new()> brings a new object into
225 existence and forges the connection to the server all in one
226 operation, which is often what you want.  For applications that need
227 more control, however, these two method separate the two steps,
228 allowing additional steps in between such as the setting of options.
229
230 C<create()> creates and returns a new Connection object, which is
231 I<not> connected to any server.  It may be passed an options block, of
232 type C<ZOOM::Options> (see below), into which options may be set
233 before or after the creation of the Connection.  The connection to the
234 server may then be forged by the C<connect()> method, the arguments of
235 which are the same as those of the C<new()> constructor.
236
237 =head4 error_x() / errcode() / errmsg() / addinfo() / diagset()
238
239  ($errcode, $errmsg, $addinfo, $diagset) = $conn->error_x();
240  $errcode = $conn->errcode();
241  $errmsg = $conn->errmsg();
242  $addinfo = $conn->addinfo();
243  $diagset = $conn->diagset();
244
245 These methods may be used to obtain information about the last error
246 to have occurred on a connection - although typically they will not
247 been used, as the same information is available through the
248 C<ZOOM::Exception> that is thrown when the error occurs.  The
249 C<errcode()>,
250 C<errmsg()>,
251 C<addinfo()>
252 and
253 C<diagset()>
254 methods each return one element of the diagnostic, and
255 C<error_x()>
256 returns all four at once.
257
258 See the C<ZOOM::Exception> for the interpretation of these elements.
259
260 =head4 option() / option_binary()
261
262  print("server is '", $conn->option("serverImplementationName"), "'\n");
263  $conn->option(preferredRecordSyntax => "usmarc");
264  $conn->option_binary(iconBlob => "foo\0bar");
265  die if length($conn->option_binary("iconBlob") != 7);
266
267 Objects of the Connection, ResultSet, ScanSet and Package classes
268 carry with them a set of named options which affect their behaviour in
269 certain ways.  See the ZOOM-C options documentation for details:
270
271 Connection options are listed at
272 http://indexdata.com/yaz/doc/zoom.tkl#zoom.connections
273
274 These options are set and fetched using the C<option()> method, which
275 may be called with either one or two arguments.  In the two-argument
276 form, the option named by the first argument is set to the value of
277 the second argument, and its old value is returned.  In the
278 one-argument form, the value of the specified option is returned.
279
280 For historical reasons, option values are not binary-clean, so that a
281 value containing a NUL byte will be returned in truncated form.  The
282 C<option_binary()> method behaves identically to C<option()> except
283 that it is binary-clean, so that values containing NUL bytes are set
284 and returned correctly.
285
286 =head4 search() / search_pqf()
287
288  $rs = $conn->search(new ZOOM::Query::CQL('title=dinosaur'));
289  # The next two lines are equivalent
290  $rs = $conn->search(new ZOOM::Query::PQF('@attr 1=4 dinosaur'));
291  $rs = $conn->search_pqf('@attr 1=4 dinosaur');
292
293 The principal purpose of a search-and-retrieve protocol is searching
294 (and, er, retrieval), so the principal method used on a Connection
295 object is C<search()>.  It accepts a single argument, a C<ZOOM::Query>
296 object (or, more precisely, an object of a subclass of this class);
297 and it creates and returns a new ResultSet object representing the set
298 of records resulting from the search.
299
300 Since queries using PQF (Prefix Query Format) are so common, we make
301 them a special case by providing a C<search_pqf()> method.  This is
302 identical to C<search()> except that it accepts a string containing
303 the query rather than an object, thereby obviating the need to create
304 a C<ZOOM::Query::PQF> object.  See the documentation of that class for
305 information about PQF.
306
307 =head4 scan() / scan_pqf()
308
309  $rs = $conn->scan(new ZOOM::Query::CQL('title=dinosaur'));
310  # The next two lines are equivalent
311  $rs = $conn->scan(new ZOOM::Query::PQF('@attr 1=4 dinosaur'));
312  $rs = $conn->scan_pqf('@attr 1=4 dinosaur');
313
314 Many Z39.50 servers allow you to browse their indexes to find terms to
315 search for.  This is done using the C<scan> method, which creates and
316 returns a new ScanSet object representing the set of terms resulting
317 from the scan.
318
319 C<scan()> takes a single argument, but it has to work hard: it
320 specifies both what index to scan for terms, and where in the index to
321 start scanning.  What's more, the specification of what index to scan
322 includes multiple facets, such as what database fields it's an index
323 of (author, subject, title, etc.) and whether to scan for whole fields
324 or single words (e.g. the title ``I<The Empire Strikes Back>'', or the
325 four words ``Back'', ``Empire'', ``Strikes'' and ``The'', interleaved
326 with words from other titles in the same index.
327
328 All of this is done by using a Query object representing a query of a
329 single term as the C<scan()> argument.  The attributes associated with
330 the term indicate which index is to be used, and the term itself
331 indicates the point in the index at which to start the scan.  For
332 example, if the argument is the query C<@attr 1=4 fish>, then
333
334 =over 4
335
336 =item @attr 1=4
337
338 This is the BIB-1 attribute with type 1 (meaning access-point, which
339 specifies an index), and type 4 (which means ``title'').  So the scan
340 is in the title index.
341
342 =item fish
343
344 Start the scan from the lexicographically earliest term that is equal
345 to or falls after ``fish''.
346
347 =back
348
349 The argument C<@attr 1=4 @attr 6=3 fish> would behave similarly; but
350 the BIB-1 attribute 6=3 mean completeness=``complete field'', so the
351 scan would be for complete titles rather than for words occurring in
352 titles.
353
354 This takes a bit of getting used to.
355
356 The behaviour is C<scan()> is affected by the following options, which
357 may be set on the Connection through which the scan is done:
358
359 =over 4
360
361 =item number [default: 10]
362
363 Indicates how many terms should be returned in the ScanSet.  The
364 number actually returned may be less, if the start-point is near the
365 end of the index, but will not be greater.
366
367 =item position [default: 1]
368
369 A 1-based index specifying where in the returned list of terms the
370 seed-term should appear.  By default it should be the first term
371 returned, but C<position> may be set, for example, to zero (requesting
372 the next terms I<after> the seed-term), or to the same value as
373 C<number> (requesting the index terms I<before> the seed term).
374
375 =item stepSize [default: 0]
376
377 An integer indicating how many indexed terms are to be skipped between
378 each one returned in the ScanSet.  By default, no terms are skipped,
379 but overriding this can be useful to get a high-level overview of the
380 index.
381
382 Since scans using PQF (Prefix Query Format) are so common, we make
383 them a special case by providing a C<scan_pqf()> method.  This is
384 identical to C<scan()> except that it accepts a string containing the
385 query rather than an object, thereby obviating the need to create a
386 C<ZOOM::Query::PQF> object.
387
388 =back
389
390 =head4 package()
391
392  $p = $conn->package();
393  $o = new ZOOM::Options();
394  $o->option(databaseName => "newdb");
395  $p = $conn->package($o);
396
397 Creates and returns a new C<ZOOM::Package>, to be used in invoking an
398 Extended Service.  An options block may optionally be passed in.  See
399 the C<ZOOM::Package> documentation.
400
401 =head4 last_event()
402
403  if ($conn->last_event() == ZOOM::Event::CONNECT) {
404      print "Connected!\n";
405  }
406
407 Returns a C<ZOOM::Event> enumerated value indicating the type of the
408 last event that occurred on the connection.  This is used only in
409 complex asynchronous applications - see the section below on
410 C<ZOOM::Event> for more information.
411
412 B<Warning.>
413 This method has not been tested.
414
415 =head4 destroy()
416
417  $conn->destroy()
418
419 Destroys a Connection object, tearing down any low-level connection
420 associated with it and freeing its resources.  It is an error to reuse
421 a Connection that has been C<destroy()>ed.
422
423 =head2 ZOOM::ResultSet
424
425  $rs = $conn->search_pqf('@attr 1=4 mineral');
426  $n = $rs->size();
427  for $i (1 .. $n) {
428      $rec = $rs->record($i-1);
429      print $rec->render();
430  }
431
432 A ResultSet object represents the set of zero or more records
433 resulting from a search, and is the means whereby these records can be
434 retrieved.  A ResultSet object may maintain client side cache or some,
435 less, none, all or more of the server's records: in general, this is
436 supposed to an implementaton detail of no interest to a typical
437 application, although more sophisticated applications do have
438 facilities for messing with the cache.  Most applications will only
439 need the C<size()>, C<record()> and C<sort()> methods.
440
441 There is no C<new()> method nor any other explicit constructor.  The
442 only way to create a new ResultSet is by using C<search()> (or
443 C<search_pqf()>) on a Connection.
444
445 See the description of the C<Result Set> class in the ZOOM Abstract
446 API at
447 http://zoom.z3950.org/api/zoom-current.html#3.4
448
449 =head3 Methods
450
451 =head4 option()
452
453  $rs->option(elementSetName => "f");
454
455 Allows options to be set into, and read from, a ResultSet, just like
456 the Connection class's C<option()> method.  There is no
457 C<option_binary()> method for ResultSet objects.
458
459 ResultSet options are listed at
460 http://indexdata.com/yaz/doc/zoom.resultsets.tkl
461
462 =head4 size()
463
464  print "Found ", $rs->size(), " records\n";
465
466 Returns the number of records in the result set.
467
468 =head4 record() / record_immediate()
469
470  $rec = $rs->record(0);
471  $rec2 = $rs->record_immediate(0);
472  $rec3 = $rs->record_immediate(1)
473      or print "second record wasn't in cache\n";
474
475 The C<record()> method returns a C<ZOOM::Record> object representing
476 a record from result-set, whose position is indicated by the argument
477 passed in.  This is a zero-based index, so that legitimate values
478 range from zero to C<$rs->size()-1>.
479
480 The C<record_immediate()> API is identical, but it never invokes a
481 network operation, merely returning the record from the ResultSet's
482 cache if it's already there, or an undefined value otherwise.  So if
483 you use this method, B<you must always check the return value>.
484
485 =head4 records()
486
487  $rs->records(0, 10, 0);
488  for $i (0..10) {
489      print $rs->record_immediate($i)->render();
490  }
491
492  @nextseven = $rs->records(10, 7, 1);
493
494 The C<record_immediate()> method only fetches records from the cache,
495 whereas C<record()> fetches them from the server if they have not
496 already been cached; but the ZOOM module has to guess what the most
497 efficient strategy for this is.  It might fetch each record, alone
498 when asked for: that's optimal in an application that's only
499 interested in the top hit from each search, but pessimal for one that
500 wants to display a whole list of results.  Conversely, the software's
501 strategy might be always to ask for blocks of a twenty records:
502 that's great for assembling long lists of things, but wasteful when
503 only one record is wanted.  The problem is that the ZOOM module can't
504 tell, when you call C<$rs->record()>, what your intention is.
505
506 But you can tell it.  The C<records()> method fetches a sequence of
507 records, all in one go.  It takes three arguments: the first is the
508 zero-based index of the first record in the sequence, the second is
509 the number of records to fetch, and the third is a boolean indication
510 of whether or not to return the retrieved records as well as adding
511 them to the cache.  (You can always pass 1 for this if you like, and
512 Perl will discard the unused return value, but there is a small
513 efficiency gain to be had by passing 0.)
514
515 Once the records have been retrieved from the server
516 (i.e. C<records()> has completed without throwing an exception), they
517 can be fetched much more efficiently using C<record()> - or
518 C<record_immediate()>, which is then guaranteed to succeed.
519
520 =head4 cache_reset()
521
522  $rs->cache_reset()
523
524 Resets the ResultSet's record cache, so that subsequent invocations of
525 C<record_immediate()> will fail.  I struggle to imagine a real
526 scenario where you'd want to do this.
527
528 =head4 sort()
529
530  if ($rs->sort("yaz", "1=4 >i 1=21 >s") < 0) {
531      die "sort failed";
532  }
533
534 Sorts the ResultSet in place (discarding any cached records, as they
535 will in general be sorted into a different position).  There are two
536 arguments: the first is a string indicating the type of the
537 sort-specification, and the second is the specification itself.
538
539 The C<sort()> method returns 0 on success, or -1 if the
540 sort-specification is invalid.
541
542 At present, the only supported sort-specification type is C<yaz>.
543 Such a specification consists of a space-separated sequence of keys,
544 each of which itself consists of two space-separated words (so that
545 the total number of words in the sort-specification is even).  The two
546 words making up each key are a field and a set of flags.  The field
547 can take one of two forms: if it contains an C<=> sign, then it is a
548 BIB-1 I<type>=I<value> pair specifying which field to sort
549 (e.g. C<1=4> for a title sort); otherwise it is sent for the server to
550 interpret as best it can.  The word of flags is made up from one or
551 more of the following: C<s> for case sensitive, C<i> for case
552 insensitive; C<<> for ascending order and C<E<gt>> for descending
553 order.
554
555 For example, the sort-specification in the code-fragment above will
556 sort the records in C<$rs> case-insensitively in descending order of
557 title, with records having equivalent titles sorted case-sensitively
558 in ascending order of subject.  (The BIB-1 access points 4 and 21
559 represent title and subject respectively.)
560  
561 =head4 destroy()
562
563  $rs->destroy()
564
565 Destroys a ResultSet object, freeing its resources.  It is an error to
566 reuse a ResultSet that has been C<destroy()>ed.
567
568 =head2 ZOOM::Record
569
570  $rec = $rs->record($i);
571  print $rec->render();
572  $raw = $rec->raw();
573  $marc = new_from_usmarc MARC::Record($raw);
574  print "Record title is: ", $marc->title(), "\n";
575
576 A Record object represents a record that has been retrived from the
577 server.
578
579 There is no C<new()> method nor any other explicit constructor.  The
580 only way to create a new Record is by using C<record()> (or
581 C<record_immediate()>, or C<records()>) on a ResultSet.
582
583 In general, records are ``owned'' by their result-sets that they were
584 retrieved from, so they do not have to be explicitly memory-managed:
585 they are deallocated (and therefore can no longer be used) when the
586 result-set is destroyed.
587
588 See the description of the C<Record> class in the ZOOM Abstract
589 API at
590 http://zoom.z3950.org/api/zoom-current.html#3.5
591
592 =head3 Methods
593
594 =head4 render()
595
596  print $rec->render()
597
598 Returns a human-readable representation of the record.  Beyond that,
599 no promises are made: careful programs should not make assumptions
600 about the format of the returned string.
601
602 This method is useful mostly for debugging.
603
604 =head4 raw()
605
606  use MARC::Record
607  $raw = $rec->raw();
608  $marc = new_from_usmarc MARC::Record($raw);
609
610 Returns an opaque blob of data that is the raw form of the record.
611 Exactly what this is, and what you can do with it, varies depending on
612 the record-syntax.  For example, XML records will be returned as,
613 well, XML; MARC records will be returned as ISO 2709-encoded blocks
614 that can be decoded by software such as the fine C<Marc::Record>
615 module; GRS-1 record will be ... gosh, what an interesting question.
616 But no-one uses GRS-1 any more, do they?
617
618 =head4 clone() / destroy()
619
620  $rec = $rs->record($i);
621  $newrec = $rec->clone();
622  $rs->destroy();
623  print $newrec->render();
624  $newrec->destroy();
625
626 Usually, it's convenient that Record objects are owned by their
627 ResultSets and go away when the ResultSet is destroyed; but
628 occasionally you need a Record to outlive its parent and destroy it
629 later, explicitly.  To do this, C<clone()> the record, keep the new
630 Record object that is returned, and C<destroy()> it when it's no
631 longer needed.  This is B<only> situation in which a Record needs to
632 be destroyed.
633
634 =head2 ZOOM::Exception
635
636 In general, method calls throw an exception (of class
637 C<ZOOM::Exception>) if anything goes wrong, so you don't need to test
638 for success after each call.  Exceptions are caught by enclosing the
639 main code in an C<eval{}> block and checking C<$@> on exit from that
640 block, as in the code-sample above.
641
642 There are a small number of exceptions to this rule: the three
643 record-fetching methods in the C<ZOOM::ResultSet> class,
644 C<record()>,
645 C<record_immediate()>,
646 and
647 C<records()>
648 can all return undefined values for legitimate reasons, under
649 circumstances that do not merit throwing an exception.  For this
650 reason, the return values of these methods should be checked.  See the
651 individual methods' documentation for details.
652
653 An exception carries the following pieces of information:
654
655 =over 4
656
657 =item error-code
658
659 A numeric code that specifies the type of error.  This can be checked
660 for equality with known values, so that intelligent applications can
661 take appropriate action.
662
663 =item error-message
664
665 A human-readable message corresponding with the code.  This can be
666 shown to users, but its value should not be tested, as it could vary
667 in different versions or under different locales.
668
669 =item additional information [optional]
670
671 A string containing information specific to the error-code.  For
672 example, when the error-code is the BIB-1 diagnostic 109 ("Database
673 unavailable"), the additional information is the name of the database
674 that the application tried to use.  For some error-codes, there is no
675 additional information at all; for some others, the additional
676 information is undefined and may just be an human-readable string.
677
678 =item diagnostic set [optional]
679
680 A short string specifying the diagnostic set from which the error-code
681 was drawn: for example, C<ZOOM> for a ZOOM-specific error such as
682 C<ZOOM::Error::MEMORY> ("out of memory"), and C<BIB-1> for a Z39.50
683 error-code drawn from the BIB-1 diagnostic set.
684
685 =back
686
687 In theory, the error-code should be interpreted in the context of the
688 diagnostic set from which it is drawn; in practice, nearly all errors
689 are from either the ZOOM or BIB-1 diagnostic sets, and the codes in
690 those sets have been chosen so as not to overlap, so the diagnostic
691 set can usually be ignored.
692
693 See the description of the C<Exception> class in the ZOOM Abstract
694 API at
695 http://zoom.z3950.org/api/zoom-current.html#3.7
696
697 =head3 Methods
698
699 =head4 new()
700
701  die new ZOOM::Exception($errcode, $errmsg, $addinfo, $diagset);
702
703 Creates and returns a new Exception object with the specified
704 error-code, error-message, additional information and diagnostic set.
705 Applications will not in general need to use this, but may find it
706 useful to simulate ZOOM exceptions.  As is usual with Perl, exceptions
707 are thrown using C<die()>.
708
709 =head4 code() / message() / addinfo() / diagset()
710
711  print "Error ", $@->code(), ": ", $@->message(), "\n";
712  print "(addinfo '", $@->addinfo(), "', set '", $@->diagset(), "')\n";
713
714 These methods, of no arguments, return the exception's error-code,
715 error-message, additional information and diagnostic set respectively.
716
717 =head4 render()
718
719  print $@->render();
720
721 Returns a human-readable rendition of an exception.  The C<"">
722 operator is overloaded on the Exception class, so that an Exception
723 used in a string context is automatically rendered.  Among other
724 consequences, this has the useful result that a ZOOM application that
725 died due to an uncaught exception will emit an informative message
726 before exiting.
727
728 =head2 ZOOM::ScanSet
729
730  $ss = $conn->scan('@attr 1=1003 a');
731  $n = $ss->size();
732  ($term, $occ) = $ss->term($n-1);
733  $rs = $conn->search_pqf('@attr 1=1003 "' . $term . "'");
734  assert($rs->size() == $occ);
735
736 A ScanSet represents a set of candidate search-terms returned from an
737 index scan.  Its sole purpose is to provide access to those term, to
738 the corresponding display terms, and to the occurrence-counts of the
739 terms.
740
741 There is no C<new()> method nor any other explicit constructor.  The
742 only way to create a new ScanSet is by using C<scan()> on a
743 Connection.
744
745 See the description of the C<Scan Set> class in the ZOOM Abstract
746 API at
747 http://zoom.z3950.org/api/zoom-current.html#3.6
748
749 =head3 Methods
750
751 =head4 size()
752
753  print "Found ", $ss->size(), " terms\n";
754
755 Returns the number of terms in the scan set.  In general, this will be
756 the scan-set size requested by the C<number> option in the Connection
757 on which the scan was performed [default 10], but it may be fewer if
758 the scan is close to the end of the index.
759
760 =head4 term() / display_term()
761
762  $ss = $conn->scan('@attr 1=1004 whatever');
763  ($term, $occurrences) = $ss->term(0);
764  ($displayTerm, $occurrences2) = $ss->display_term(0);
765  assert($occurrences == $occurrences2);
766  if (user_likes_the_look_of($displayTerm)) {
767      $rs = $conn->search_pqf('@attr 1=4 "' . $term . '"');
768      assert($rs->size() == $occurrences);
769  }
770
771 These methods return the scanned terms themselves.  C<term()> returns
772 the term is a form suitable for submitting as part of a query, whereas
773 C<display_term()> returns it in a form suitable for displaying to a
774 user.  Both versions also return the number of occurrences of the term
775 in the index, i.e. the number of hits that will be found if the term
776 is subsequently used in a query.
777
778 In most cases, the term and display term will be identical; however,
779 they may be different in cases where punctuation or case is
780 normalised, or where identifiers rather than the original document
781 terms are indexed.
782
783 =head4 option()
784
785  print "scan status is ", $ss->option("scanStatus");
786
787 Allows options to be set into, and read from, a ScanSet, just like
788 the Connection class's C<option()> method.  There is no
789 C<option_binary()> method for ScanSet objects.
790
791 ScanSet options are also described, though not particularly
792 informatively, at
793 http://indexdata.com/yaz/doc/zoom.scan.tkl
794
795 =head4 destroy()
796
797  $ss->destroy()
798
799 Destroys a ScanSet object, freeing its resources.  It is an error to
800 reuse a ScanSet that has been C<destroy()>ed.
801
802 =head2 ZOOM::Package
803
804  $p = $conn->package();
805  $p->option(action => "specialUpdate");
806  $p->option(recordIdOpaque => 145);
807  $p->option(record => content_of("/tmp/record.xml"));
808  $p->send("update");
809  $p->destroy();
810
811 This class represents an Extended Services Package: an instruction to
812 the server to do something not covered by the core parts of the Z39.50
813 standard (or the equivalent in SRW or SRU).  Since the core protocols
814 are read-only, such requests are often used to make changes to the
815 database, such as in the record update example above.
816
817 Requesting an extended service is a four-step process: first, create a
818 package associated with the connection to the relevant database;
819 second, set options on the package to instruct the server on what to
820 do; third, send the package (which may result in an exception being
821 thrown if the server cannot execute the requested operations; and
822 finally, destroy the package.
823
824 Package options are listed at
825 http://indexdata.com/yaz/doc/zoom.ext.html
826
827 The particular options that have meaning are determined by the
828 top-level operation string specified as the argument to C<send()>.
829 For example, when the operation is C<update> (the most commonly used
830 extended service), the C<action> option may be set to any of
831 C<recordInsert>
832 (add a new record, failing if that record already exists),
833 C<recordDelete>
834 (delete a record, failing if it is not in the database).
835 C<recordReplace>
836 (replace a record, failing if an old version is not already present)
837 or
838 C<specialUpdate>
839 (add a record, replacing any existing version that may be present).
840
841 For update, the C<record> option should be set to the full text of the
842 XML record to added, deleted or replaced.  Depending on how the server
843 is configured, it may extract the record's unique ID from the text
844 (i.e. from a known element such as the C<001> field of a MARCXML
845 record), or it may require the unique ID to passed in explicitly using
846 the C<recordIdOpaque> option.
847
848 Extended services packages are B<not currently described> in the ZOOM
849 Abstract API at
850 http://zoom.z3950.org/api/zoom-current.html
851 They will be added in a forthcoming version, and will function much
852 as those implemented in this module.
853
854 =head3 Methods
855
856 =head4 option()
857
858  $p->option(recordIdOpaque => "46696f6e61");
859
860 Allows options to be set into, and read from, a Package, just like
861 the Connection class's C<option()> method.  There is no
862 C<option_binary()> method for Package objects.
863
864 Package options are listed at
865 http://indexdata.com/yaz/doc/zoom.ext.tkl
866
867 =head4 send()
868
869  $p->send("createdb");
870
871 Sends a package to the server associated with the Connection that
872 created it.  Problems are reported by throwing an exception.  The
873 single parameter indicates the operation that the server is being
874 requested to perform, and controls the interpretation of the package's
875 options.  Valid operations include:
876
877 =over 4
878
879 =item itemorder
880
881 Request a copy of a nominated object, e.g. place an ILL request.
882
883 =item create
884
885 Create a new database, the name of which is specified by the
886 C<databaseName> option.
887
888 =item drop
889
890 Drop an existing database, the name of which is specified by the
891 C<databaseName> option.
892
893 =item commit
894
895 Commit changes made to the database within a transaction.
896
897 =item update
898
899 Modify the contents of the database by adding, deleting or replacing
900 records (as described above in the overview of the C<ZOOM::Package>
901 class).
902
903 =item xmlupdate
904
905 I have no idea what this does.
906
907 =back
908
909 Although the module is capable of I<making> all these requests, not
910 all servers are capable of I<executing> them.  Refusal is indicated by
911 throwing an exception.  Problems may also be caused by lack of
912 privileges; so C<send()> must be used with caution, and is perhaps
913 best wrapped in a clause that checks for execptions, like so:
914
915  eval { $p->send("create") };
916  if ($@ && $@->isa("ZOOM::Exception")) {
917      print "Oops!  ", $@->message(), "\n";
918      return $@->code();
919  }
920
921 =head4 destroy()
922
923  $p->destroy()
924
925 Destroys a Package object, freeing its resources.  It is an error to
926 reuse a Package that has been C<destroy()>ed.
927
928 =head2 ZOOM::Query
929
930  $q = new ZOOM::Query::CQL("creator=pike and subject=unix");
931  $q->sortby("1=4 >i 1=21 >s");
932  $rs = $conn->search($q);
933  $q->destroy();
934
935 C<ZOOM::Query> is a virtual base class from which various concrete
936 subclasses can be derived.  Different subclasses implement different
937 types of query.  The sole purpose of a Query object is to be used in a
938 C<search()> on a Connection; because PQF is such a common special
939 case, the shortcut Connection method C<search_pqf()> is provided.
940
941 The following Query subclasses are provided, each providing the
942 same set of methods described below:
943
944 =over 4
945
946 =item ZOOM::Query::PQF
947
948 Implements Prefix Query Format (PQF), also sometimes known as Prefix
949 Query Notation (PQN).  This esoteric but rigorous and expressive
950 format is described in the YAZ Manual at
951 http://indexdata.com/yaz/doc/tools.tkl#PQF
952
953 =item ZOOM::Query::CQL
954
955 Implements the Common Query Language (CQL) of SRU, the Search/Retrieve
956 URL.  CQL is a much friendlier notation than PQF, using a simple infix
957 notation.  The queries are passed ``as is'' to the server rather than
958 being compiled into a Z39.50 Type-1 query, so only CQL-compliant
959 servers can support such querier.  CQL is described at
960 http://www.loc.gov/standards/sru/cql/
961 and in a slight out-of-date but nevertheless useful tutorial at
962 http://zing.z3950.org/cql/intro.html
963
964 =item ZOOM::Query::CQL2RPN
965
966 Implements CQL by compiling it on the client-side into a Z39.50
967 Type-1 (RPN) query, and sending that.  This provides essentially the
968 same functionality as C<ZOOM::Query::CQL>, but it will work against
969 any standard Z39.50 server rather than only against the small subset
970 that support CQL natively.  The drawback is that, because the
971 compilation is done on the client side, a configuration file is
972 required to direct the mapping of CQL constructs such as index names,
973 relations and modifiers into Type-1 query attributes.  An example CQL
974 configuration file is included in the ZOOM-Perl distribution, in the
975 file C<samples/cql/pqf.properties>
976
977 =back
978
979 See the description of the C<Query> class in the ZOOM Abstract
980 API at
981 http://zoom.z3950.org/api/zoom-current.html#3.3
982
983 =head3 Methods
984
985 =head4 new()
986
987  $q = new ZOOM::Query::CQL('title=dinosaur');
988  $q = new ZOOM::Query::PQF('@attr 1=4 dinosaur');
989
990 Creates a new query object, compiling the query passed as its argument
991 according to the rules of the particular query-type being
992 instantiated.  If compilation fails, an exception is thrown.
993 Otherwise, the query may be passed to the C<Connection> method
994 C<search()>.
995
996  $conn->option(cqlfile => "samples/cql/pqf.properties");
997  $q = new ZOOM::Query::CQL2RPN('title=dinosaur', $conn);
998
999 Note that for the C<ZOOM::Query::CQL2RPN> subclass, the Connection
1000 must also be passed into the constructor.  This is used for two
1001 purposes: first, its C<cqlfile> option is used to find the CQL
1002 configuration file that directs the translations into RPN; and second,
1003 if compilation fails, then diagnostic information is cached in the
1004 Connection and be retrieved using C<$conn-E<gt>errcode()> and related
1005 methods.
1006
1007 =head4 sortby()
1008
1009  $q->sortby("1=4 >i 1=21 >s");
1010
1011 Sets a sort specification into the query, so that when a C<search()>
1012 is run on the query, the result is automatically sorted.  The sort
1013 specification language is the same as the C<yaz> sort-specification
1014 type of the C<ResultSet> method C<sort()>, described above.
1015
1016 =head4 destroy()
1017
1018  $p->destroy()
1019
1020 Destroys a Query object, freeing its resources.  It is an error to
1021 reuse a Query that has been C<destroy()>ed.
1022
1023 =head2 ZOOM::Options
1024
1025  $o1 = new ZOOM::Options();
1026  $o1->option(user => "alf");
1027  $o2 = new ZOOM::Options();
1028  $o2->option(password => "fruit");
1029  $opts = new ZOOM::Options($o1, $o2);
1030  $conn = create ZOOM::Connection($opts);
1031  $conn->connect($host); # Uses the specified username and password
1032
1033 Several classes of ZOOM objects carry their own sets of options, which
1034 can be manipulated using their C<option()> method.  Sometimes,
1035 however, it's useful to deal with the option sets directly, and the
1036 C<ZOOM::Options> class exists to enable this approach.
1037
1038 Option sets are B<not currently described> in the ZOOM
1039 Abstract API at
1040 http://zoom.z3950.org/api/zoom-current.html
1041 They are an extension to that specification.
1042
1043 =head3 Methods
1044
1045 =head4 new()
1046
1047  $o1 = new ZOOM::Options();
1048  $o1and2 = new ZOOM::Options($o1);
1049  $o3 = new ZOOM::Options();
1050  $o1and3and4 = new ZOOM::Options($o1, $o3);
1051
1052 Creates and returns a new option set.  One or two (but no more)
1053 existing option sets may be passed as arguments, in which case they
1054 become ``parents'' of the new set, which thereby ``inherits'' their
1055 options, the values of the first parent overriding those of the second
1056 when both have a value for the same key.  An option set that inherits
1057 from a parent that has its own parents also inherits the grandparent's
1058 options, and so on.
1059
1060 =head4 option() / option_binary()
1061
1062  $o->option(preferredRecordSyntax => "usmarc");
1063  $o->option_binary(iconBlob => "foo\0bar");
1064  die if length($o->option_binary("iconBlob") != 7);
1065
1066 These methods are used to get and set options within a set, and behave
1067 the same way as the same-named C<Connection> methods - see above.  As
1068 with the C<Connection> methods, values passed to and retrieved using
1069 C<option()> are interpreted as NUL-terminated, while those passed to
1070 and retrieved from C<option_binary()> are binary-clean.
1071
1072 =head4 bool()
1073
1074  $o->option(x => "T");
1075  $o->option(y => "F");
1076  assert($o->bool("x", 1));
1077  assert(!$o->bool("y", 1));
1078  assert($o->bool("z", 1));
1079
1080 The first argument is a key, and the second is a default value.
1081 Returns the value associated with the specified key as a boolean, or
1082 the default value if the key has not been set.  The values C<T> (upper
1083 case) and C<1> are considered true; all other values (including C<t>
1084 (lower case) and non-zero integers other than one) are considered
1085 false.
1086
1087 This method is provided in ZOOM-C because in a statically typed
1088 language it's convenient to have the result returned as an
1089 easy-to-test type.  In a dynamically typed language such as Perl, this
1090 problem doesn't arise, so C<bool()> is nearly useless; but it is made
1091 available in case applications need to duplicate the idiosyncratic
1092 interpretation of truth and falsehood and ZOOM-C uses.
1093
1094 =head4 int()
1095
1096  $o->option(x => "012");
1097  assert($o->int("x", 20) == 12);
1098  assert($o->int("y", 20) == 20);
1099
1100 Returns the value associated with the specified key as an integer, or
1101 the default value if the key has not been set.  See the description of
1102 C<bool()> for why you almost certainly don't want to use this.
1103
1104 =head4 set_int()
1105
1106  $o->set_int(x => "29");
1107
1108 Sets the value of the specified option as an integer.  Of course, Perl
1109 happily converts strings to integers on its own, so you can just use
1110 C<option()> for this, but C<set_int()> is guaranteed to use the same
1111 string-to-integer conversion as ZOOM-C does, which might occasionally
1112 be useful.  Though I can't imagine how.
1113
1114 =head4 set_callback()
1115
1116  sub cb {
1117      ($udata, $key) = @;
1118      return "$udata-$key-$udata";
1119  }
1120  $o->set_callback(\&cb, "xyz");
1121  assert($o->option("foo") eq "xyz-foo-xyz");
1122
1123 This method allows a callback function to be installed in an option
1124 set, so that the values of options can be calculated algorithmically
1125 rather than, as usual, looked up in a table.  Along with the callback
1126 function itself, an additional datum is provided: when an option is
1127 subsequently looked up, this datum is passed to the callback function
1128 along with the key; and its return value is returned to the caller as
1129 the value of the option.
1130
1131 B<Warning.>
1132 Although it ought to be possible to specify callback function using
1133 the C<\&name> syntax above, or a literal C<sub { code }> code
1134 reference, the complexities of the Perl-internal memory management
1135 system mean that the function must currently be specified as a string
1136 containing the fully-qualified name, e.g. C<"main::cb">.>
1137
1138 B<Warning.>
1139 The current implementation of the this method leaks memory, not only
1140 when the callback is installed, but on every occasion that it is
1141 consulted to look up an option value.
1142
1143 =head4 destroy()
1144
1145  $o->destroy()
1146
1147 Destroys an Options object, freeing its resources.  It is an error to
1148 reuse an Options object that has been C<destroy()>ed.
1149
1150 =head1 ENUMERATIONS
1151
1152 The ZOOM module provides two enumerations that list possible return
1153 values from particular functions.  They are described in the following
1154 sections.
1155
1156 =head2 ZOOM::Error
1157
1158  if ($@->code() == ZOOM::Error::QUERY_PQF) {
1159      return "your query was not accepted";
1160  }
1161
1162 This class provides a set of manifest constants representing some of
1163 the possible error codes that can be raised by the ZOOM module.  The
1164 methods that return error-codes are
1165 C<ZOOM::Exception::code()>,
1166 C<ZOOM::Connection::error_x()>
1167 and
1168 C<ZOOM::Connection::errcode()>.
1169
1170 The C<ZOOM::Error> class provides the constants
1171 C<NONE>,
1172 C<CONNECT>,
1173 C<MEMORY>,
1174 C<ENCODE>,
1175 C<DECODE>,
1176 C<CONNECTION_LOST>,
1177 C<INIT>,
1178 C<INTERNAL>,
1179 C<TIMEOUT>,
1180 C<UNSUPPORTED_PROTOCOL>,
1181 C<UNSUPPORTED_QUERY>,
1182 C<INVALID_QUERY>,
1183 C<CREATE_QUERY>,
1184 C<QUERY_CQL>,
1185 C<QUERY_PQF>,
1186 C<SORTBY>,
1187 C<CLONE>,
1188 C<PACKAGE>,
1189 C<SCANTERM>
1190 and
1191 C<LOGLEVEL>,
1192 each of which specifies a client-side error.  These codes constitute
1193 the C<ZOOM> diagnostic set.
1194
1195 Since errors may also be diagnosed by the server, and returned to the
1196 client, error codes may also take values from the BIB-1 diagnostic set
1197 of Z39.50, listed at the Z39.50 Maintenance Agency's web-site at
1198 http://www.loc.gov/z3950/agency/defns/bib1diag.html
1199
1200 All error-codes, whether client-side from the C<ZOOM::Error>
1201 enumeration or server-side from the BIB-1 diagnostic set, can be
1202 translated into human-readable messages by passing them to the
1203 C<ZOOM::diag_str()> utility function.
1204
1205 =head2 ZOOM::Event
1206
1207  if ($conn->last_event() == ZOOM::Event::CONNECT) {
1208      print "Connected!\n";
1209  }
1210
1211 In applications that need it - mostly complex multiplexing
1212 applications - The C<ZOOM::Connection::last_event()> method is used to
1213 return an indication of the last event that occurred on a particular
1214 connection.  It always returns a value drawn from this enumeration,
1215 that is, one of C<NONE>, C<CONNECT>, C<SEND_DATA>, C<RECV_DATA>,
1216 C<TIMEOUT>, C<UNKNOWN>, C<SEND_APDU>, C<RECV_APDU>, C<RECV_RECORD> or
1217 C<RECV_SEARCH>.
1218
1219 You almost certainly don't need to know about this.  Frankly, I'm not
1220 sure how to use it myself.
1221
1222 =head1 LOGGING
1223
1224  ZOOM::Log::init_level(ZOOM::Log::mask_str("zoom,myapp,-warn"));
1225  ZOOM::Log::log("myapp", "starting up with pid ", $$);
1226
1227 Logging facilities are provided by a set of functions in the
1228 C<ZOOM::Log> module.  Note that C<ZOOM::Log> is not a class, and it
1229 is not possible to create C<ZOOM::Log> objects: the API is imperative,
1230 reflecting that of the underlying YAZ logging facilities.  Although
1231 there are nine logging functions altogether, you can ignore nearly
1232 all of them: most applications that use logging will begin by calling
1233 C<mask_str()> and C<init_level()> once each, as above, and will then
1234 repeatedly call C<log()>.
1235
1236 =head2 mask_str()
1237
1238  $level = ZOOM::Log::mask_str("zoom,myapp,-warn");
1239
1240 Returns an integer corresponding to the log-level specified by the
1241 parameter.  This is a string of zero or more comma-separated
1242 module-names, each indicating an individual module to be either added
1243 to the default log-level or removed from it (for those components
1244 prefixed by a minus-sign).  The names may be those of either standard
1245 YAZ-logging modules such as C<fatal>, C<debug> and C<warn>, or custom
1246 modules such as C<myapp> in the example above.  The module C<zoom>
1247 requests logging from the ZOOM module itself, which may be helpful for
1248 debugging.
1249
1250 Note that calling this function does not in any way change the logging
1251 state: it merely returns a value.  To change the state, this value
1252 must be passed to C<init_level()>.
1253
1254 =head2 module_level()
1255
1256  $level = ZOOM::Log::module_level("zoom");
1257  ZOOM::Log::log($level, "all systems clear: thrusters invogriated");
1258
1259 Returns the integer corresponding to the single log-level specified as
1260 the parameter, or zero if that level has not been registered by a
1261 prior call to C<mask_str()>.  Since C<log()> accepts either a numeric
1262 log-level or a string, there is no reason to call this function; but,
1263 what the heck, maybe you enjoy that kind of thing.  Who are we to
1264 judge?
1265
1266 =head2 init_level()
1267
1268  ZOOM::Log::init_level($level);
1269
1270 Initialises the log-level to the specified integer, which is a bitmask
1271 of values, typically as returned from C<mask_str()>.  All subsequent
1272 calls to C<log()> made with a log-level that matches one of the bits
1273 in this mask will result in a log-message being emitted.  All logging
1274 can be turned off by calling C<init_level(0)>.
1275
1276 =head2 init_prefix()
1277
1278  ZOOM::Log::init_prefix($0);
1279
1280 Initialises a prefix string to be included in all log-messages.
1281
1282 =head2 init_file()
1283
1284  ZOOM::Log::init_file("/tmp/myapp.log");
1285
1286 Initialises the output file to be used for logging: subsequent
1287 log-messages are written to the nominated file.  If this function is
1288 not called, log-messages are written to the standard error stream.
1289
1290 =head2 init()
1291
1292  ZOOM::Log::init($level, $0, "/tmp/myapp.log");
1293
1294 Initialises the log-level, the logging prefix and the logging output
1295 file in a single operation.
1296
1297 =head2 time_format()
1298
1299  ZOOM::Log::time_format("%Y-%m-%d %H:%M:%S");
1300
1301 Sets the format in which log-messages' timestamps are emitted, by
1302 means of a format-string like that used in the C function
1303 C<strftime()>.  The example above emits year, month, day, hours,
1304 minutes and seconds in big-endian order, such that timestamps can be
1305 sorted lexicographically.
1306
1307 =head2 init_max_size()
1308
1309 (This doesn't seem to work, so I won't bother describing it.)
1310
1311 =head2 log()
1312
1313  ZOOM::Log::log(8192, "reducing to warp-factor $wf");
1314  ZOOM::Log::log("myapp", "starting up with pid ", $$);
1315
1316 Provided that the first argument, log-level, is among the modules
1317 previously established by C<init_level()>, this function emits a
1318 log-message made up of a timestamp, the prefix supplied to
1319 C<init_prefix()>, if any, and the concatenation of all arguments after
1320 the first.  The message is written to the standard output stream, or
1321 to the file previous specified by C<init_file()> if this has been
1322 called.
1323
1324 The log-level argument may be either a numeric value, as returned from
1325 C<module_level()>, or a string containing the module name.
1326
1327 =head1 SEE ALSO
1328
1329 The ZOOM abstract API,
1330 http://zoom.z3950.org/api/zoom-current.html
1331
1332 The C<Net::Z3950::ZOOM> module, included in the same distribution as this one.
1333
1334 The C<Net::Z3950> module, which this one supersedes.
1335 http://perl.z3950.org/
1336
1337 The documentation for the ZOOM-C module of the YAZ Toolkit, which this
1338 module is built on.  Specifically, its lists of options are useful.
1339 http://indexdata.com/yaz/doc/zoom.tkl
1340
1341 The BIB-1 diagnostic set of Z39.50,
1342 http://www.loc.gov/z3950/agency/defns/bib1diag.html
1343
1344 =head1 AUTHOR
1345
1346 Mike Taylor, E<lt>mike@indexdata.comE<gt>
1347
1348 =head1 COPYRIGHT AND LICENCE
1349
1350 Copyright (C) 2005 by Index Data.
1351
1352 This library is free software; you can redistribute it and/or modify
1353 it under the same terms as Perl itself, either Perl version 5.8.4 or,
1354 at your option, any later version of Perl 5 you may have available.
1355
1356 =cut
1357
1358 1;