Hey folks,
Apologies if this is a very extreme utterly really nubie question, but I
am
trying to learn Ruby and have run into a bit of a snag with a small
program
that attempts to define a method with four variables. The program fails
with the following error message:
zoom.rb:4:in open': Connect failed (10000) z3950.loc.gov (RuntimeError) :7090 from zoom.rb:4:in
zoomreturn’
from zoom.rb:21
What’s weird is that if I go through irb and type in the entire method
def
and then supply it with four variables, the program works. So I’m
pretty
stymied.
The program is below. Note that the “zoom” stuff I’m referring to in
here
is a particular protocol that queries library catalogs. The ruby module
for
it is at http://ruby-zoom.rubyforge.org
If anyone wants to try it themselves to see, try using the following
variables for server, dbname, syntax, isbn:
z3950.loc.gov
Voyager
USMARC
0253333490
If it works correctly, the method should return a MARC record
(basically, an
electronic library card) about a book on dinosaurs.
Thanks for taking a look,
jf.
require ‘zoom’
def zoomreturn(server, dbname, syntax, isbn)
ZOOM::Connection.open(server, 7090) do |conn|
conn.database_name = dbname
conn.preferred_record_syntax = syntax
rset = conn.search(isbn)
p rset [0]
end
end
puts “Server:”
server = gets
puts “dbname:”
dbname = gets
puts “Syntax:”
syntax = gets
puts “isbn:”
isbn = gets
zoomreturn(server, dbname, syntax, isbn)