I have a perl script which takes input from an html form, and appends the
info to an XML file.
My code works fine if I run it from the command line (substituting in values
for the form values) but when I run it by calling it from a SUBMIT button, it
wont alter the XML file at all.
the permissions on the XML file are set as -rw -rw -r--
and it's owned by root
The perl script is owned by root
No errors show up in the log file.
Here is the code which opens the xml file , reads down to just before the
last tag, then inserts the new tags (I open the xml file twice, i dont like
that..is there a more elegant way to do this? I had trouble getting seek to
do what I wanted it to). Also, I dont do any xml parsing with this program,
so I dont use any special XML modules. This is just a simple add text to
file program.
____________________
#open file to read in info
open(File, "</var/www/html/tech/xml/report.xml") or die("couldnt open");
seek(File, 0,0);
@text = <File>; #read the file into an array
close(File);
#open file to write in old info with new info
open(oFile, ">/var/www/html/tech/xml/report.xml");
foreach $line (@text){
chomp($line);
if( $line eq "</report>" ){
print oFile "\t<item>\n";
print oFile "\t\t<reqDate>".$date."</reqDate>\n";
print oFile "\t\t<teacher>".$tchName."</teacher>\n";
print oFile "\t\t<request>".$explain."</request>\n";
print oFile "\t\t<status>S</status>\n";
print oFile "\t\t<compDate>-</compDate>\n";
print oFile "\t</item>\n";
}
print oFile "$line\n";
}
close(oFile);
___________________________
I want to emphasize that it works perfectly if I run it from the command line.
And I've tried referencing the file as both how I have it above and as
/tech/xml/report.xml
Thanks in advance
Jeremy
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]