Skip to main content.
home | support | download

Back to List Archive

Wierd apostrophe problem!!

From: stuart <stuart(at)not-real.mohawk.net>
Date: Thu Apr 30 1998 - 20:09:21 GMT
I am inches away from getting SWISH-E to work but ran into a small but
mighty snag. I run SWISH-E on BSD UNIX and the program is called from a
Perl5 script via a web page. I need to pass words(names) with
apostrophes to SWISH-E such as O'Rourke. But when I first did this I got
this error:

Unmatched single quote 'rourke

Which makes sense when you figure it sees the single apostrphe hanging
there not bounded by quotes. If I simply run the swish program from the
command line with O'Rourke as my word I get:

Unmatched '.

Unless I pass it "O'Rourke" which it likes. So, I made a small test
script that I run from the command line that looks like this:

#!/usr/bin/perl5
$swish_path = "/var/www/search/swish-e";
while (<>) {
    $input = qq|"O'Rourke"|;      # override any input for now
   open(SEARCH, "$swish_path/swish-e -w $input -t c -f
$swish_path/indexes/index01 -m 30|") || die "Can't Open Pipe";
   while ($_ = <SEARCH>) {                # keep going while we have
input
      print "$_\n";
   }
   close(SEARCH);
}

Using the qq Perl5 feature along with "" allows this to work! In other
words, without either the qq or the double quotes it fails. However,
when the SAME code is put into my (Perl5) cgi script(with input values
overriding those from the form) it fails with the same error as before.
What is different about the cgi script as opposed to the script run from
the command prompt that could cause two identical routines to both
succeed and fail? Any ideas will be most appreciated! Thanks.

-Stuart
Received on Thu Apr 30 13:11:07 1998