#! /usr/bin/perl
######################################################################
# This program allows a java Applet to write direct to a web server #
# It is based on an article "Java Jive" by Scott Clark #
######################################################################print "content-type: text/plain\n\n";
# print content type header top the browser
open(OUT,">>111111.TST");
print OUT ">>>>>> <<<<<<<<";
# open the file 111111.TST for writing (move "cursor" to start)
# (>> means append to file)
while(<>){ # I don't know which file handle is being read?
print OUT $_; # print what is read from the file handle to the file
# referenced by the handle OUT
print $_;
}
print OUT "Has this been successful?";
print "Has this been successful?";
close(OUT);
#close the filehandle
exit 0;
#exit
I am very new to perl, how can I identify what is being received from the applet, and why the file is not being written? The applet sends this header when called the perl script :
data="POST \\user\\htdocs\\cgi-bin\\ResUpd.pl HTTP/1.0\r\nContent-type: text/plain\r\n"+
"Content-length: "+data.length()+"\r\n\r\n"+data;
Can anyone point me in the right direction?
regards
KPJ
I can't see anything obviously wrong with your code. The problem could range from a bug in your script, an error in the way your applet tries to call it, a permission error with opening the file, etc. I suggest you try debugging by testing different stages. For example:
A couple of questions and comments:
Shawn