X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=lib%2FZOOM%2FIRSpy%2FUtils.pm;h=09f6b8f1869829e4e1dbf41bc4e07b3caf9116a0;hb=7756fea114005961008fd69527ba5876c814ac51;hp=e24fd6ca569c6478f602f7c74aa98bb87e4c98f8;hpb=7e30dd5f86e43b3e2f19b33d713d413168c7fd6b;p=irspy-moved-to-github.git diff --git a/lib/ZOOM/IRSpy/Utils.pm b/lib/ZOOM/IRSpy/Utils.pm index e24fd6c..09f6b8f 100644 --- a/lib/ZOOM/IRSpy/Utils.pm +++ b/lib/ZOOM/IRSpy/Utils.pm @@ -1,4 +1,4 @@ -# $Id: Utils.pm,v 1.27 2007-04-27 14:04:40 mike Exp $ +# $Id: Utils.pm,v 1.29 2007-05-01 15:29:36 mike Exp $ package ZOOM::IRSpy::Utils; @@ -181,11 +181,24 @@ sub irspy_record2identifier { # a null transform; now we have to be a bit cleverer. # sub irspy_identifier2target { + my $res = _irspy_identifier2target(@_); + #carp "converted ID '@_' to target '$res'"; + return $res; +} + +sub _irspy_identifier2target { my($id) = @_; my($protocol, $target) = ($id =~ /(.*?):(.*)/); - print STDERR "protocol='$protocol', target='$target'\n"; - ### This assumes everything is Z39.50 + if (uc($protocol) eq "Z39.50") { + return "tcp:$target"; + } elsif (uc($protocol) eq "SRU") { + return "sru=get,http:$target"; + } elsif (uc($protocol) eq "SRW") { + return "sru=srw,http:$target"; + } + + warn "unrecognised protocol '$protocol' in ID $id"; return $target; }