Skip to main content.
home | support | download

Back to List Archive

Re: [SWISH-E:268] Wierd apostrophe problem!!

From: Roy Tennant <rtennant(at)>
Date: Fri May 01 1998 - 14:35:32 GMT
I've been wondering about the complexity of the solutions I've been seeing
posted here. What's wrong with simply wrapping quotes around the query
string? Like so:

open(SWISH, "$swish -w \"$query\" -m 0 -f $database|");

My Perl ignorance is probably showing, since I can't figure out why you
would need anything more complex than that.

On Thu, 30 Apr 1998, stuart wrote:

> 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 Fri May 1 07:43:33 1998