[OPEN-ILS-DEV] PATCH: Use ZOOM perl module instead of Net::Z3950

Dan Scott denials at gmail.com
Sun May 27 21:02:14 EDT 2007


Hey Mike:

I hacked OpenILS/Application/Search/Z3950.pm to use
OpenILS::Utils::ZClient and it worked well with ZOOM in place, but
failed with a deep recursion error in Net/Z3950.pm on line 184 when I
move ZOOM.pm out of the way (Net::Z3950::Connection->new invokes
Net::Z3950::Manager->new which invokes Net::Z3950::Connection->new,
etc...). Taking a peek at Net/Z3950.pm suggests that the pre-existing
Net/Z3950.pm gets overwritten by an evil ZOOM stub module that will
eventually emulate the old Net::Z3950 interface, but currently is
b0rken. All an aside to say that it works here with ZOOM, so if it
works for you with the old Net::Z3950 then we're probably good to go.

I think there's one critical tweak for this to work: you need to make
ZClient.pm return true. I won't bother sending you a patch for that :)

Thanks for this elegant solution!

Dan

On 27/05/07, Mike Rylander <mrylander at gmail.com> wrote:
> On 5/27/07, Mike Rylander <mrylander at gmail.com> wrote:
> > On 5/27/07, Dan Scott <denials at gmail.com> wrote:
> > > The current Z3950 search relies on the Net::Z3950 Perl module, which
> > > has been deprecated in favour of ZOOM (brought to you by the makers of
> > > yaz, indexdata.dk). Currently, when you try to install Net::Z3950 from
> > > CPAN or read its documentation, it very strongly warns you away from
> > > using it in favour of ZOOM.
> > >
> > > It turns out that the API for ZOOM is almost identical to Net::Z3950,
> > > so this patch is relatively small. The major differences are the
> > > reliance on search_pqf() to issue the search and the returned records
> > > are 0-indexed rather than 1-indexed. We might be able to do more with
> > > ZOOM's exceptions but I haven't looked into that. I have tested it
> > > with Evergreen 1.1.5 and it works for cataloging resources from LC.
> > > Unfortunately I do not have an OCLC account so I can't test
> > > authenticated connections -- but from reading the ZOOM docs, it looks
> > > like it should work.
> > >
> > > One potential drawback to ZOOM is that it requires a version of yaz >=
> > > 2.1.50 (released 2007/02/03) as a prerequisite. Gentoo currently
> > > offers a maximum of 2.1.42 (released 2006/12/17) even in its unstable
> > > ebuild, so I had to build yaz from source. Depending on what level of
> > > yaz other distributions package, we might want to leave this patch in
> > > the queue for a while as we might be trading off one set of headaches
> > > (Net::Z3950 is a deprecated package! EG is dumb for forcing me to
> > > install a deprecated package on my system!) for another (ZOOM requires
> > > yaz >= 2.1.50! EG is dumb for forcing me to install a package from
> > > source on my system!).
> >
> > I've created an abstraction interface to address this issue.  It looks
> > for either module, preferring ZOOM, and if the Net module is used then
> > it modifies the interface a bit to make it look like ZOOM.
> >
> > Would you mind tossing the attached file into
> > /openils/lib/perl5/OpenILS/Utils/ or your equivalent and then using
> > that instead of the direct ZOOM or Net::Z3950 interface inside
> > OpenILS::Application::Search::Z3950?  The change should be straight
> > forward, but if not I can explain further.
> >
> > I'd test this, but I'll have no time today and I wanted to get this
> > out there for someone to look at.
>
> And here's an updated one that simplifies the use of
> UNIVERSAL::require.  I'll come back to this tomorrow, and TIA for
> putting eyes on this.
>
> --miker
>
> >
> > TIA!
> >
> > --miker
> >
> > >
> > > Developer's Certificate of Origin 1.1
> > >
> > > By making a contribution to this project, I certify that:
> > > (a) The contribution was created in whole or in part by me and I have
> > > the right to submit it under the open source license indicated in the
> > > file; or
> > > (b) The contribution is based upon previous work that, to the best of
> > > my knowledge, is covered under an appropriate open source license and
> > > I have the right under that license to submit that work with
> > > modifications, whether created in whole or in part by me, under the
> > > same open source license (unless I am permitted to submit under a
> > > different license), as indicated in the file; or
> > > (c) The contribution was provided directly to me by some other person
> > > who certified (a), (b) or (c) and I have not modified it; and
> > > (d) In the case of each of (a), (b), or (c), I understand and agree
> > > that this project and the contribution are public and that a record of
> > > the contribution (including all personal information I submit with it,
> > > including my sign-off) is maintained indefinitely and may be
> > > redistributed consistent with this project or the open source license
> > > indicated in the file.
> > >
> > > --
> > > Dan Scott
> > > Laurentian University
> > >
> > >
> >
> >
> > --
> > Mike Rylander
> >
> >
>
>
> --
> Mike Rylander
>
>


-- 
Dan Scott
Laurentian University


More information about the Open-ils-dev mailing list