From: mike Date: Tue, 11 Apr 2006 16:27:01 +0000 (+0000) Subject: Fix ZOOM::Connection::new so that options are handled in accordance X-Git-Tag: cpan_1_22~194 X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=commitdiff_plain;h=a2c81c671713ee59edc0adcdfe345accd629b234;p=ZOOM-Perl-moved-to-github.git Fix ZOOM::Connection::new so that options are handled in accordance with the documentation: applied _before_ the connection is forged, so that "async" and similar options can take effect. --- diff --git a/lib/ZOOM.pm b/lib/ZOOM.pm index 29695a9..16eef44 100644 --- a/lib/ZOOM.pm +++ b/lib/ZOOM.pm @@ -1,4 +1,4 @@ -# $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; @@ -290,22 +290,24 @@ sub new { 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; }