Check YAZ version is recent enough.
[ZOOM-Perl-moved-to-github.git] / lib / Net / Z3950 / ZOOM.pm
1 # $Id: ZOOM.pm,v 1.8 2006-01-20 12:33:30 mike Exp $
2
3 package Net::Z3950::ZOOM; 
4
5 use 5.008;
6 use strict;
7 use warnings;
8
9 our $VERSION = '1.02';
10
11 require XSLoader;
12 XSLoader::load('Net::Z3950::ZOOM', $VERSION);
13
14 my($vs, $ss) = ("", "");
15 my $version = Net::Z3950::ZOOM::yaz_version($vs, $ss);
16 if ($version < 0x02010B) {
17     warn <<__EOT__;
18 *** WARNING!
19 ZOOM-Perl requires at least version 2.0.11 of YAZ, but is currently
20 running against only version $vs.  Some things may not work.
21 __EOT__
22 }
23
24 # The only thing this module does is define the following constants,
25 # which MUST BE KEPT SYNCHRONISED with the definitions in <yaz/zoom.h>
26
27 # Error codes, as returned from connection_error()
28 sub ERROR_NONE { 0 }
29 sub ERROR_CONNECT { 10000 }
30 sub ERROR_MEMORY { 10001 }
31 sub ERROR_ENCODE { 10002 }
32 sub ERROR_DECODE { 10003 }
33 sub ERROR_CONNECTION_LOST { 10004 }
34 sub ERROR_INIT { 10005 }
35 sub ERROR_INTERNAL { 10006 }
36 sub ERROR_TIMEOUT { 10007 }
37 sub ERROR_UNSUPPORTED_PROTOCOL { 10008 }
38 sub ERROR_UNSUPPORTED_QUERY { 10009 }
39 sub ERROR_INVALID_QUERY { 10010 }
40 sub ERROR_CQL_PARSE { 10011 }
41 sub ERROR_CQL_TRANSFORM { 10012 }
42
43 # Event types, as returned from connection_last_event()
44 sub EVENT_NONE { 0 }
45 sub EVENT_CONNECT { 1 }
46 sub EVENT_SEND_DATA { 2 }
47 sub EVENT_RECV_DATA { 3 }
48 sub EVENT_TIMEOUT { 4 }
49 sub EVENT_UNKNOWN { 5 }
50 sub EVENT_SEND_APDU { 6 }
51 sub EVENT_RECV_APDU { 7 }
52 sub EVENT_RECV_RECORD { 8 }
53 sub EVENT_RECV_SEARCH { 9 }
54
55
56 =head1 NAME
57
58 Net::Z3950::ZOOM - Perl extension for invoking the ZOOM-C API.
59
60 =head1 SYNOPSIS
61
62  use Net::Z3950::ZOOM;
63  $conn = Net::Z3950::ZOOM::connection_new($host, $port);
64  $errcode = Net::Z3950::ZOOM::connection_error($conn, $errmsg, $addinfo);
65  Net::Z3950::ZOOM::connection_option_set($conn, databaseName => "foo");
66  # etc.
67
68 =head1 DESCRIPTION
69
70 This module provides a simple thin-layer through to the ZOOM-C
71 functions in the YAZ toolkit for Z39.50 and SRW/U communication.  You
72 should not be using this very nasty, low-level API.  You should be
73 using the C<ZOOM> module instead, which implements a nice, Perlish API
74 on top of this module, conformant to the ZOOM Abstract API described at
75 http://zoom.z3950.org/api/
76
77 To enforce the don't-use-this-module prohibition, I am not even going
78 to document it.  If you really, really, really want to use it, then it
79 pretty much follows the API described in the ZOOM-C documentation at
80 http://www.indexdata.dk/yaz/doc/zoom.tkl
81
82 =head1 SEE ALSO
83
84 The C<ZOOM> module, included in the same distribution as this one.
85
86 =head1 AUTHOR
87
88 Mike Taylor, E<lt>mike@indexdata.comE<gt>
89
90 =head1 COPYRIGHT AND LICENCE
91
92 Copyright (C) 2005 by Index Data.
93
94 This library is free software; you can redistribute it and/or modify
95 it under the same terms as Perl itself, either Perl version 5.8.4 or,
96 at your option, any later version of Perl 5 you may have available.
97
98 =cut
99
100 1;