Using Net::Z3950 on MS-Windows

7th October 2002

It Doesn't Work

Despite one or two apocryphal success stories (and I'd love to get a definitive one), most people who have tried to build the Net::Z3950 module on Microsoft's Windows operating systems have found that they can't get the Event module (a prerequisite) built. This is a real irritant, since it stops my perfectly good software from running on an operating system which, however misguidedly, is pretty ubiquitous out there.

Hopefully the Event module will get fixed at some point, so that it runs under Windows, and then the approach described below will not be necessary. (Or maybe someone will rewrite Net::Z3950 to use a different and more portable event loop.) Until then, here's an alternative:

What To Do Instead

Dale Couch <Dale.Couch@channelinc.com> has found a way to use something more or less equivalent to the Net::Z3950 module under Windows.

Perl on Windows allows you to load ActiveX components through the OLE interface. You can then interact with the Object just like the VB people can. You can use this technique to access Thomas Habing's Visual Basic binding for the ZOOM model which underlies Net::Z3950 (see zoom.z3950.org/bind/vb)

Then your Windows box can run Z39.50 client programs, in Perl, like this one:

#!perl -w
use strict;
use Win32::OLE;
 
my $oZ3950 = Win32::OLE->new('VBZOOMC.ZoomFactory');
my $oConnection = $oZ3950->CreateZoomConnection('z3950.loc.gov', 7090);
$oConnection->SetOption('databaseName','Voyager');
$oConnection->SetOption('preferredRecordSyntax', 'USmarc');
my $oQuery = $oZ3950->CreateZoomQuery('@attr 1=7 0596000715');
my $oResult = $oConnection->Search($oQuery);
print $oResult->GetRecord(0)->XMLData->xml;
[download]

Enjoy!

Feedback to <mike@indexdata.com> is welcome!