+# Quotes a term for use in a CQL query
+sub cql_quote {
+ my($term) = @_;
+
+ $term =~ s/([""\\])/\\$1/g;
+ $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 ("host=" . cql_quote($host) . " and " .
+ "port=" . cql_quote($port) . " and " .
+ "path=" . cql_quote($db));
+}
+
+