-# $Id: ZOOM.pm,v 1.31 2006-04-07 12:58:19 mike Exp $
+# $Id: ZOOM.pm,v 1.32 2006-04-11 16:27:01 mike Exp $
use strict;
use warnings;
my $class = shift();
my($host, $port, @options) = @_;
- my $_conn = Net::Z3950::ZOOM::connection_new($host, $port || 0);
- my $conn = bless {
- host => $host,
- port => $port,
- _conn => $_conn,
- };
-
+ my $_opts = Net::Z3950::ZOOM::options_create();
while (@options >= 2) {
my $key = shift(@options);
my $val = shift(@options);
- $conn->option($key, $val);
+ Net::Z3950::ZOOM::options_set($_opts, $key, $val);
}
die "Odd number of options specified"
if @options;
+ my $_conn = Net::Z3950::ZOOM::connection_create($_opts);
+ Net::Z3950::ZOOM::connection_connect($_conn, $host, $port);
+ my $conn = bless {
+ host => $host,
+ port => $port,
+ _conn => $_conn,
+ };
+
$conn->_check();
return $conn;
}