develooper Front page | perl.beginners | Postings from March 2002

system command problem

Thread Next
Gavin Nelmes-Crocker [CobaltWorld]
March 15, 2002 15:27
system command problem
Message ID:
Guys, I've got a newbie question - I have been hacking at a perl script to
change it to do what I want - it nearly does but I can't understand why the
main bit isn't working.  Basically the script gets sent a string from an
html form which it then needs to use as part of a system command.

I'm not sure if or how you use a variable in a system command but even if I
replace the variable with the value it still doesn't work - the drawback is
the command needs to be run by root hence I can only do it this way.  I'm
sure there are bits of the script not needed and I need help with the system

Any ideas




# readform.cgi
# reads form data and generates a page

# for GET data
# for POST data
$code = <STDIN>;

# Remove spaces if any
$code =~ s/\+/ /g;

# split form data and store in hash
%details = split (/=/, $code);

system("/usr/bin/fms_registration $value /usr/bin/fmserverd");

# generate page
print "Content-Type: text/html\n\n";
print "<html><body>";

while (($name, $value) = each %details)
print ("/usr/bin/fms_registration $value /usr/bin/fmserverd");

print "</body></html>";

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About