|
Posted by A. Sinan Unur on May 15, 2008, 8:57 pm
Please log in for more thread options
kronecker@yahoo.co.uk wrote in news:27a86a81-91bd-4d5c-87ff-
1b7db0770aeb@v26g2000prm.googlegroups.com:
> I create a text file on the server remote.txt ok with the following
> code (the last part of it)
You should always, yes always,
use strict;
use warnings;
> $first_name = $FORM;
> $last_name = $FORM;
>
> open (example, ">remote.txt") || die ("Could not open file. $!");
We have been through this once before
my $filename = 'remote.txt';
open my $EXAMPLE, '>', $filename
or die "Cannot open '$filename': $!";
> print example "$first_name\n$last_name\n";
print $EXAMPLE "$first_name\n$last_name\n";
> close (example);
It is crucial to check for errors on close on a filehandle opened for
writing.
close $EXAMPLE or die "Error closing '$filename': $!";
> print "Content-type:text/html\r\n\r\n";
> This bit causes errors...... chmod
> 0777,'remote.txt'; ......................................
What errors does it cause?
chmod 0777, $filename
or die "Cannot chmod on '$filename': $!";
Have you read perldoc -f chmod and perldoc -f umask?
> print "<html>";
> print "<head>";
> print "<title> Processed</title>";
> print "</head>";
> print "<body>";
> print "<h2>Commands $first_name $last_name - Sent to text file</h2>";
> print "</body>";
> print "</html>";
Don't be silly!
print <<EO_HTML;
<html>
<head>
<title>Processed<title>
</head>
<body>
<h2>Commands $first_name $last_name - Sent to text file</h2>
</body>
</html>
EO_HTML
> The problem is that I need to be able to delete this file remotely
> using FTP and the script generate a new version every now and then. I
> need teh script to make the file deleteable. How do I do this?
> I tried chmod 0777,'remote.txt' and it spews out errors.
Did you try looking at the error messages?
Sinan
--
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
|