-/* $Id: ZOOM.xs,v 1.10 2005-10-12 16:13:00 mike Exp $ */
+/* $Id: ZOOM.xs,v 1.11 2005-10-13 13:30:52 mike Exp $ */
#include "EXTERN.h"
#include "perl.h"
PROTOTYPES: ENABLE
-# TESTED
-#
# It seems that when one of these functions is called from Perl with
# a string-constant argument, that is not recognised as suitable to
# be mapped onto a "const char*" argument. The only fix I can find is
# overriding the auto-generated prototyping with PROTOTYPE: $$
# doesn't help (and indeed seems to make no difference at all).
#
+# TESTED
ZOOM_connection
ZOOM_connection_new(host, portnum)
char* host
int portnum
+# TESTED
ZOOM_connection
ZOOM_connection_create(options)
ZOOM_options options
+# TESTED
void
ZOOM_connection_connect(c, host, portnum)
ZOOM_connection c
int portnum
# TESTED
-#
void
ZOOM_connection_destroy(c)
ZOOM_connection c
# TESTED
-#
const char *
ZOOM_connection_option_get(c, key)
ZOOM_connection c
const char *key
# TESTED
-#
void
ZOOM_connection_option_set(c, key, val)
ZOOM_connection c
const char * val
int len
-# TESTED
-#
# The reference parameters, `cp' and `addinfo', need to already have
# values when this function is called, otherwise an "uninitialised
# value" warning is generated. As far as I can see, there is no way
# support for const char**, but who can blame it? If you ask me, the
# whole "const" thing was well-intentioned by ghastly mistake.
#
+# TESTED
int
ZOOM_connection_error(c, cp, addinfo)
ZOOM_connection c
ZOOM_connection c
# TESTED
-#
const char *
ZOOM_diag_str(error)
int error
ZOOM_connection arg0
ZOOM_query q
-# TESTED
-#
# "const" discarded from type of `q'
+#
+# TESTED
ZOOM_resultset
ZOOM_connection_search_pqf(c, q)
ZOOM_connection c
char *q
# TESTED
-#
void
ZOOM_resultset_destroy(r)
ZOOM_resultset r
const char * val
# TESTED
-#
size_t
ZOOM_resultset_size(r)
ZOOM_resultset r
size_t count
# TESTED
-#
ZOOM_record
ZOOM_resultset_record(s, pos)
ZOOM_resultset s
ZOOM_resultset_cache_reset(r)
ZOOM_resultset r
-# TESTED
-#
# "const" discarded from type of `type'
# See "typemap" for discussion of the "const char *" return-type.
+#
+# TESTED
const char *
ZOOM_record_get(rec, type, len)
ZOOM_record rec
ZOOM_options_callback c
void * handle
+# TESTING
ZOOM_options
ZOOM_options_create()
-# $Id: 1-Net-Z3950-ZOOM.t,v 1.5 2005-10-12 16:13:34 mike Exp $
+# $Id: 1-Net-Z3950-ZOOM.t,v 1.6 2005-10-13 13:31:11 mike Exp $
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl Net-Z3950-ZOOM.t'
$host = "indexdata.com/gils";
$conn = Net::Z3950::ZOOM::connection_new($host, 0);
$errcode = Net::Z3950::ZOOM::connection_error($conn, $errmsg, $addinfo);
-ok($errcode == 0, "connection to '$host' OK");
+ok($errcode == 0, "connection to '$host'");
+
+Net::Z3950::ZOOM::connection_destroy($conn);
+ok(1, "destroyed connection");
+
+my $options = Net::Z3950::ZOOM::options_create();
+print STDERR "options='$options'\n";
+
+$conn = Net::Z3950::ZOOM::connection_create($options);
+$errcode = Net::Z3950::ZOOM::connection_error($conn, $errmsg, $addinfo);
+ok($errcode == 0, "unconnected connection object created");
+Net::Z3950::ZOOM::connection_connect($conn, $host, 0);
+$errcode = Net::Z3950::ZOOM::connection_error($conn, $errmsg, $addinfo);
+ok($errcode == 0, "delayed connection to '$host'");
my $syntax = "usmarc";
Net::Z3950::ZOOM::connection_option_set($conn,
$query = '@attr 1=4 minerals';
$rs = Net::Z3950::ZOOM::connection_search_pqf($conn, $query);
$errcode = Net::Z3950::ZOOM::connection_error($conn, $errmsg, $addinfo);
-ok($errcode == 0, "search for '$query' OK");
+ok($errcode == 0, "search for '$query'");
my $n = Net::Z3950::ZOOM::resultset_size($rs);
ok($n == 1, "found 1 record as expected");