X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=lib%2FZOOM%2FIRSpy%2FUtils.pm;h=cbdb5c8a4ab4edc229b4fc91148b20433a59c44e;hb=3c4477e7a38ce6badda0cd3a1242c090fa128022;hp=c31d188ef6f757ad7f8e88501cdb0a0eacd21e6b;hpb=25180091cc6e101d3b7c684c07e541f544364aaa;p=irspy-moved-to-github.git diff --git a/lib/ZOOM/IRSpy/Utils.pm b/lib/ZOOM/IRSpy/Utils.pm index c31d188..cbdb5c8 100644 --- a/lib/ZOOM/IRSpy/Utils.pm +++ b/lib/ZOOM/IRSpy/Utils.pm @@ -1,4 +1,4 @@ -# $Id: Utils.pm,v 1.22 2007-03-01 13:51:18 mike Exp $ +# $Id: Utils.pm,v 1.24 2007-03-01 13:59:45 mike Exp $ package ZOOM::IRSpy::Utils; @@ -10,6 +10,7 @@ use Exporter 'import'; our @EXPORT_OK = qw(isodate xml_encode cql_quote + cql_target irspy_xpath_context modify_xml_document bib1_access_point); @@ -66,11 +67,19 @@ sub cql_quote { my($term) = @_; $term =~ s/([""\\])/\\$1/g; - $term = qq["$term"] if $term =~ /\s/; + $term = qq["$term"] if $term =~ /[\s""\/]/; return $term; } +# Makes a CQL query that finds a specified target +sub cql_target { + my($host, $port, $db) = @_; + + return "rec.id=" . cql_quote("$host:$port/$db"); +} + + # PRIVATE to irspy_namespace() and irspy_xpath_context() my %_namespaces = ( e => 'http://explain.z3950.org/dtd/2.0/',