in reply to Perl script 'hanging' a server?

In lines like this: $sql="SELECT `cid`,`name`,`descr` FROM ".$f->conf('pre')."categories"; All of those backquotes are executing external shell commands, attempting to execute "cid", "name", "descr" etc. They fail to find the command but it is still forking and executing the shell for each one. Just take all the backquotes out of your sql statement, and it should work. $sql="SELECT cid,name,descr FROM ".$f->conf('pre')."categories";

Replies are listed 'Best First'.
Re: Re: Perl script 'hanging' a server?
by BUU (Prior) on Oct 23, 2002 at 02:21 UTC
    Thats a thought, and if all those back quotes really were shelling out, that would indeed do bad things. However, i believe you'll find that back quotes do not infact open and execute shell commands when they're embedded in double/single quotes.

      ...in Perl. That is, in many shells, "this `is` that" does try to run the 'is' command, but Perl does not do that.

      From perlop:

      In particular, contrary to the expectations of shell programmers, back-quotes do NOT interpolate within double quotes, nor do single quotes impede evaluation of variables when used within double quotes.

      The only characters that are special inside of double quotes are $, @, \, and your delimiter(s). For example, inside qq{}, the special characters are $, @, \, {, and }.

              - tye (but "my friends don't run `Tye`")