X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;ds=sidebyside;f=lib%2FZOOM.pm;h=48af46a58e61d199bb2e53601d77d316ba03896b;hb=c1ff60d1378d49166ea3bd6a2da0c7b7550e940e;hp=0e3e5836f05346d3e9e32ff2e1f667b5e97112bb;hpb=a093850375464520c98525423b6222f89e7f7b1a;p=ZOOM-Perl-moved-to-github.git diff --git a/lib/ZOOM.pm b/lib/ZOOM.pm index 0e3e583..48af46a 100644 --- a/lib/ZOOM.pm +++ b/lib/ZOOM.pm @@ -1,4 +1,4 @@ -# $Id: ZOOM.pm,v 1.36 2006-10-04 17:15:03 mike Exp $ +# $Id: ZOOM.pm,v 1.37 2006-10-10 16:51:59 mike Exp $ use strict; use warnings; @@ -330,7 +330,7 @@ sub new { host => $host, port => $port, _conn => $_conn, - }; + }, $class; $conn->_check(); return $conn; @@ -359,14 +359,29 @@ sub _check { sub create { my $class = shift(); - my($options) = @_; + my(@options) = @_; + + my $_opts; + if (@_ == 1) { + $_opts = $_[0]->_opts(); + } else { + $_opts = Net::Z3950::ZOOM::options_create(); + while (@options >= 2) { + my $key = shift(@options); + my $val = shift(@options); + Net::Z3950::ZOOM::options_set($_opts, $key, $val); + } - my $_conn = Net::Z3950::ZOOM::connection_create($options->_opts()); + die "Odd number of options specified" + if @options; + } + + my $_conn = Net::Z3950::ZOOM::connection_create($_opts); return bless { host => undef, port => undef, _conn => $_conn, - }; + }, $class; } sub error_x {