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

system command problem

Thread Next
From:
Gavin Nelmes-Crocker [CobaltWorld]
Date:
March 15, 2002 15:27
Subject:
system command problem
Message ID:
KPEIJFOOOMFHMMLFNPMCEEFJEDAA.developers@cobaltworld.com
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
command.

Any ideas

Regards

Gavin

 #!/usr/bin/perl

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

# for GET data
if ($ENV{'REQUEST_METHOD'} eq "GET")
{
$code=$ENV{'QUERY_STRING'};
}
# for POST data
 else
{
$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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About