Gossamer Forum
Home : General : Perl Programming :

CHMOD via a CGI Script

Quote Reply
CHMOD via a CGI Script
sub new_data_file {
open(NEWFILE,">$basedir/$username/data.txt") | | die $!;
print NEWFILE "0\n";
close(NEWFILE);
}

How can I get the above to CHMOD data.txt 777? What coding do I need to add?
Quote Reply
Re: CHMOD via a CGI Script In reply to
drop to a command line and type

perldoc -f chmod and that will explain all you need to know.

--mark
Quote Reply
Re: CHMOD via a CGI Script In reply to
Uh, I have no idea what you are talking about. All I need is to know what peice of code I need to add...
Quote Reply
Re: CHMOD via a CGI Script In reply to
And if you do what he showed you, you will get the code you need.
RTFM will save us yet, I have faith.

-- Gordon


------------------
s/(\d{2})/chr($1)/eg && print if $_ = '85836932677173468077327879843282696568806582836933';
Quote Reply
Re: CHMOD via a CGI Script In reply to
I don't even know what the comand line is...
Quote Reply
Re: CHMOD via a CGI Script In reply to
The command line is the following:

Code:
(chmod 0777, $basedir/$username/data.txt);

So, with codes, your codes should look like the following:

Code:
sub new_data_file {
open(NEWFILE,">$basedir/$username/data.txt") or die $!;
(chmod 0777, $basedir/$username/data.txt);
print NEWFILE "0\n";
close(NEWFILE);
}

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: CHMOD via a CGI Script In reply to
No Eliot, that isn't the command line, that is the command itself.

The point I was trying to make was, that all of Perl's documentation is available right on the machine. It is much better to point someone to the documentation instead of giving the answer outright (teach a man to fish....)

Command line refers to dropping to DOS on a Windows machine with Perl installed, or telneting into the Unix host.

Once at the command line, typing perldoc -f chmod, whill show the perl documentation of the chmod function.

--mark
Quote Reply
Re: CHMOD via a CGI Script In reply to
I appreciate the "teach a man to fish" lesson, but I have a perl book, I read the part on CHMOD, I couldn't get it to work. So I came to this forum. Well, I found someone in the Yahoo chat room who helped me. But thanks to all of you guys anyways.