Gossamer Forum
Home : General : Perl Programming :

chmod(0666, $file);

Quote Reply
chmod(0666, $file);
Hi. could someone please point me in the direction as to why this won't work., I looked at perldoc.com to see if i could find an answer to see if my code was wrong, but according to them it is correct. The code i am using is;

$file="test.txt";
chmod(0755, $file);

and the code they are showing is;

chmod(644, $file); # WRONG -- perl -w catches this
chmod(0644, $file); # right

Could anyone please help me out. I know how to run it via Net::FTP, but for some reason using the other code to do it on a local server won't work! Frown

HELP!!!

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: chmod(0666, $file); In reply to
You may have to specify the full path to the file you want to chmod.

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: chmod(0666, $file); In reply to
If you are running a Windows server, then chmod won't work.

Regards,

Eliot Lee
Quote Reply
Re: chmod(0666, $file); In reply to
Who's code youradds? Smile

Paul Wilson.
http://www.wiredon.net/gt/
http://www.perlmad.com/
Quote Reply
Re: chmod(0666, $file); In reply to
Try looking aty http://www.perldoc.com/...rpreted correctly%3f. Thats where i was looking! Cool

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: chmod(0666, $file); In reply to
Umm you didn't understand what I was saying......nm

Paul Wilson.
http://www.wiredon.net/gt/
http://www.perlmad.com/
Quote Reply
Re: chmod(0666, $file); In reply to
astroboy solved it..

you have to use the full path on chmod..

its probably trying to chmod a 'test.txt' in your root folder on your server..

the same goes with stat ("fullpath");

Jerry Su
widgetz sucks
Quote Reply
Re: chmod(0666, $file); In reply to
If i use;

$file="/home/ace-inst/public_html/cgi-bin/links/cgi-bin/admin/data/link.db";
chmod(0666, $file);

It doesn't work still! I've tried it on other servers incase it was mine, but it won't work on them either :( I know the path is correct, but it just doesn't want to CHMOD the file....

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: chmod(0666, $file); In reply to
Try:

chmod(0666, $file) or die "can't chmod: $file ($!)";

Always error check. =)

Cheers,

Alex

--
Gossamer Threads Inc.