X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=lib%2FZOOM%2FIRSpy%2FUtils.pm;h=475e9deeda19ed7aa5ac076a61cd6cdcaf27dbeb;hb=05630e3dfe14355424516e6a2879b651620b114f;hp=856e60250f41ece095a591499d892a4170763f6e;hpb=c46ad5836a9a08d7da8df72a3661eaca376d3020;p=irspy-moved-to-github.git diff --git a/lib/ZOOM/IRSpy/Utils.pm b/lib/ZOOM/IRSpy/Utils.pm index 856e602..475e9de 100644 --- a/lib/ZOOM/IRSpy/Utils.pm +++ b/lib/ZOOM/IRSpy/Utils.pm @@ -181,6 +181,7 @@ sub cql_target { } return "rec.id=" . cql_quote($id); + #return "rec.id_raw=" . cql_quote($id); } @@ -284,13 +285,14 @@ sub _irspy_identifier2target { confess "_irspy_identifier2target(): id is undefined" if !defined $id; - my($protocol, $target) = ($id =~ /(.*?):(.*)/); + my($prefix, $protocol, $target) = ($id =~ /([^:]*,)?(.*?):(.*)/); + $prefix ||= ""; if (uc($protocol) eq "Z39.50" || uc($protocol) eq "TCP") { - return "tcp:$target"; + return "${prefix}tcp:$target"; } elsif (uc($protocol) eq "SRU") { - return "sru=get,http:$target"; + return "${prefix}sru=get,http:$target"; } elsif (uc($protocol) eq "SRW") { - return "sru=srw,http:$target"; + return "${prefix}sru=srw,http:$target"; } warn "_irspy_identifier2target($id): unrecognised protocol '$protocol'"; @@ -848,7 +850,7 @@ sub validate_record { my @errors = $id; if ($tests{'protocol'}) { - push(@errors, 'protocol number is not valid') if $protocol !~ /^(z39\.50|sru|srw|tcp)$/; + push(@errors, 'protocol number is not valid') if $protocol !~ /^(z39\.50|sru|srw|tcp)$/i; } if ($tests{'port'}) { @@ -861,7 +863,7 @@ sub validate_record { if ($tests{'database'}) { push(@errors, 'database name is not valid') if $dbname =~ m,/,i; - push(@errors, 'database has trailing spaces') if $dbname ne trimField($dbname); + push(@errors, 'database has trailing spaces') if $dbname =~ /^\s+|\s+$/; } if ($tests{'hosturl'}) {