Mike Taylor


Net::Z3950 - Perl extension for talking to Z39.50 servers.


(This code blocks in reads: see below for sample non-blocking code which allows multiple servers to be searched in parallel.)

        use Net::Z3950;

        $conn = new Net::Z3950::Connection('server.host.name', 210)
            or die $!;
        $rs = $conn->search('au=kernighan or su=unix')
            or die $conn->errmsg();

        my $n = $rs->size();
        print "found $n records:\n";
        foreach $i (1..$n) {
            $rec = $rs->record($i) or die $rs->errmsg();
            print $rec->render();



This module provides a Perl interface to the Z39.50 information retrieval protocol (aka. ISO 23950), a mature and powerful protocol used in application domains as diverse as bibliographic information, geo-spatial mapping, museums and other cultural heritage information, and structured vocabulary navigation.

Net::Z3950.pm is an implementation of the Perl binding for ZOOM, the Z39.50 Objct Orientation Model. Bindings for the same abstract API are, or will be, available in other languages including C, C++, Java and Tcl.

Two basic approaches are possible to building clients with this module:

  • The simple synchronous approach considers blocking reads acceptable, and therefore allows a straightforward style of imperative programming. This approach is suitable for clients which only talk to one server at a time, and is exemplified by the code in the SYNOPSIS section above.

  • The more complex asynchronous approach, appropriate for clients which multiplex simultaneous connections, requires a slightly less familiar event-driven programming style, as exemplified in the ASYNCHRONOUS SYNOPSIS section below.

(The simpler synchronous interface functions are implemented as a thin layer on top of the asynchronous functions.)


(This code does not block in reads, and so is suitable for broadcast clients which search multiple servers simultaneously: see above for simpler sample code that blocks in reads.)

### To be written


The Net::Z3950 module itself provides very few functions: most of the functionality is provided by the daughter modules included by Net::Z3950 - Net::Z3950::Manager, Net::Z3950::Connection, etc.


        $errcode = $conn->errcode();
        $errmsg = Net::Z3950::errmsg($errcode);
        print "error $errcode ($errmsg)\n";

Returns an English-language string describing the error indicated by the Z39.50 BIB-1 diagnostic error code $errcode.


        $str = Net::Z3950::opstr($conn->errop());
        print "error occurred in $str\n";

Returns an English-language string describing the operation indicated by the argument, which must be one of the Net::Z3950::Op::* constants described in the documentation for the Net::Z3950::Connection class's op() method.


Mike Taylor <mike@tecc.co.uk>

First version Tuesday 23rd May 2000.


The ZOOM API for Z39.50, of which this is an implementation, is fully specified at http://zoom.z3950.org where links to other implementations may also be found.

This module is built on Index Data's Yaz (Yet Another Z39.50) toolkit, which is freely available at http://indexdata.dk/yaz/

Index Data also provide a variety of other useful Z39.50 software including the free server/database Zebra, the commercial server/database Z'mbol, a Tcl interface to Z39.50 called Ir/Tcl, and a free web-to-Z39.50 gateway called Zap. See their home page at http://indexdata.dk/

The best source of information about Z39.50 itself is the official Mainenance Agency at http://lcweb.loc.gov/z3950/agency/