5 our $VERSION = '0.99'; # Supersedes "proper" Net::Z3950 v0.51
8 # Member naming convention is the same as in ../ZOOM.pm
10 # ----------------------------------------------------------------------------
11 # Enumerations are copied from the old Net::Z3950 module.
12 # It's not entirely clear yet which of these we actually need, for for
13 # now I am commenting them all out, and faulting in the ones we need.
14 # ----------------------------------------------------------------------------
16 # Define the operation-code enumeration. The values here are chosen
17 # to be in a distinctive range (i.e. 3950 plus a small integer) so
18 # that if they are misused in another context, they're easy to spot.
19 package Net::Z3950::Op;
29 ## Define the record-syntax enumeration. These values must be kept
30 ## synchronised with the values implied by the oid_value enumeration in
31 ## the header file "yaz/oid.h"
32 #package Net::Z3950::RecordSyntax;
39 #sub LIBRISMARC { 22 }
60 #sub APPLICATION_XML { 81 }
63 ## Maps record-syntax name strings to enumeration members
64 #%map = (UNIMARC => UNIMARC,
65 # INTERMARC => INTERMARC,
70 # LIBRISMARC => LIBRISMARC,
76 # PICAMARC => PICAMARC,
78 # IBERMARC => IBERMARC,
87 # EXTENDED => EXTENDED,
88 # TEXT_HTML => TEXT_HTML,
90 # TEXT_XML => TEXT_XML,
91 # APPLICATION_XML => APPLICATION_XML,
96 ## Define the reason-for-decodeAPDU()-failure enumeration. This must
97 ## be kept synchronised with the values #defined in "yazwrap/yazwrap.h"
98 #package Net::Z3950::Reason;
99 #sub EOF { 23951 } # read EOF from connection (server gone)
100 #sub Incomplete { 23952 } # read bytes, but not yet a whole APDU
101 #sub Malformed { 23953 } # couldn't decode APDU (malformed)
102 #sub BadAPDU { 23954 } # APDU was well-formed but unrecognised
103 #sub Error { 23955 } # some other error (consult errno)
107 ## Define the query-type enumeration. This must be kept synchronised
108 ## with the values #defined in "yazwrap/yazwrap.h"
109 #package Net::Z3950::QueryType;
110 #sub Prefix { 39501 } # Yaz's "@attr"-ish forward-Polish notation
111 #sub CCL { 39502 } # Send CCL string to server ``as is''
112 #sub CCL2RPN { 39503 } # Convert CCL to RPN (type-1) locally
113 #sub CQL { 39504 } # Send CQL string to server ``as is''
117 ## Define the result-set-status enumeration, used by the
118 ## `resultSetStatus' field in the Net::Z3950::APDU::SearchResponse
119 ## class in cases where `searchStatus' is false (indicating failure).
120 ## This must be kept synchronised with the ASN.1 for the structure
121 ## described in section 3.2.2.1.11 of the Z39.50 standard itself.
122 #package Net::Z3950::ResultSetStatus;
129 ## Define the present-status enumeration, used by the `presentStatus'
130 ## field in the Net::Z3950::APDU::SearchResponse class in cases where
131 ## `searchStatus' is true (indicating success). This must be kept
132 ## synchronised with the ASN.1 for the structure described in section
133 ## 3.2.2.1.11 of the Z39.50 standard itself.
134 #package Net::Z3950::PresentStatus;
144 ## Define the scan-status enumeration, used by the `scanStatus'
145 ## field in the Net::Z3950::APDU::ScanResponse class. This must be
146 ## kept synchronised with the ASN.1 for the structure described in
147 ## section 3.2.8.1.6 of the Z39.50 standard itself.
148 #package Net::Z3950::ScanStatus;
158 # ----------------------------------------------------------------------------
164 # This is not 100% compatible, because it will translate
165 # ZOOM-level errors as well as BIB-1 diagnostic codes.
166 return Net::Z3950::ZOOM::diag_str($errcode)
171 return "error" if $op == Net::Z3950::Op::Error;
172 return "init" if $op == Net::Z3950::Op::Init;
173 return "search" if $op == Net::Z3950::Op::Search;
174 return "get" if $op == Net::Z3950::Op::Get;
175 return "deleteRS" if $op == Net::Z3950::Op::DeleteRS;
176 return "scan" if $op == Net::Z3950::Op::Scan;
177 return "unknown op " . $op;
181 # ----------------------------------------------------------------------------
183 package Net::Z3950::Manager;
184 sub new { Net::Z3950::Connection->new() }
187 # ----------------------------------------------------------------------------
189 package Net::Z3950::Connection;
192 die "The Net::Z3950::ZOOM distribution does not yet support the Net::Z3950 'Classic' API. A subsequent version will do so; until then, please continue using Net::Z3950 itself if you need its API."