findftp
July 5th, 2001, 15:21
Hello,
I have a small problem (I guess). I have made a script that is able to write another script to disc and chmod it so that it is executable.
I don't want to read data from another file because the script that's being printed to file is requested 120,000 times a day
But when I print :
print "Content-type: text/html\n\n";
to the file, the printed file will look like:
print "Content-type: text/html
";
So I have to make filters that convert \n into \\n
I also think that when I print a @ into the script, the script will give an error.
Are there any filters out there in the world that convert all Perl command into the same command with a \ in front of it, so that it is being escaped?
If not, could somebody give me a list with special characters/commands that cannot be written into a script without escaping it?
Below the script that outputs another script (note the double escape at the line break behind Content-type:text/html):
#!/usr/bin/perl
open(TEST, ">test.cgi");
flock(TEST, 2);
print TEST <<"CGI code";
#!/usr/bin/perl
print "Content-type: text/html\\n\\n";
print "This is a very often accessed script";
CGI code
close(TEST);
chmod(0755, "./test.cgi");
print "Content-type: text/html\n\n";
print "<html><head><title></title></head><body>Script updated!</body></html>";
Thanks for any help,
Michiel
I have a small problem (I guess). I have made a script that is able to write another script to disc and chmod it so that it is executable.
I don't want to read data from another file because the script that's being printed to file is requested 120,000 times a day
But when I print :
print "Content-type: text/html\n\n";
to the file, the printed file will look like:
print "Content-type: text/html
";
So I have to make filters that convert \n into \\n
I also think that when I print a @ into the script, the script will give an error.
Are there any filters out there in the world that convert all Perl command into the same command with a \ in front of it, so that it is being escaped?
If not, could somebody give me a list with special characters/commands that cannot be written into a script without escaping it?
Below the script that outputs another script (note the double escape at the line break behind Content-type:text/html):
#!/usr/bin/perl
open(TEST, ">test.cgi");
flock(TEST, 2);
print TEST <<"CGI code";
#!/usr/bin/perl
print "Content-type: text/html\\n\\n";
print "This is a very often accessed script";
CGI code
close(TEST);
chmod(0755, "./test.cgi");
print "Content-type: text/html\n\n";
print "<html><head><title></title></head><body>Script updated!</body></html>";
Thanks for any help,
Michiel