sending multiple variables to external PERL script for results
| From: | Dave VanAuken | Date: | Wed, 26 Sep 2001 12:47:21 +0000 |
| Subject: | sending multiple variables to external PERL script for results | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-68845@lists.php.net to get a copy of this message | ||
Problem;
call external perl script with variables as arguments when variables may have
spaces or other restricted characters.
Details;
script needs to process $name $phone $creditcard (as examples)
normally this would easily be solved passing the command as
$command="myscript.pl $name $phone $ccnum";
$results=passthru($command);
and parsing out the argv's in the perl script
however, this breaks if $name happens to have a space in it (or other restricted
or special characters like ' \ ; and so forth) since it creates an additional
arg (or error)
"myscript.pl Joe Schmoe 555-1212 1234123412341234" = 4 arguments passed not 3
This particular application is restricted to using preexisting perl libraries
and modules, or we would simply recode the entire process in PHP in integrate it
more solidly into the solution.
perhaps result of being up all night... can't wrap my head around it.
Dave