CHMOD a perl script created file
Posted by TedH (TedH), 5 June 2005The blog script I'm working on does everything except CHMOD the small perl script used for adding a comment. It works a treat if I manually set the permission, but I need the file creation to do that.
The code seen is the sub routine which writes the script and shows the chmod code after closing the file. This chmod is straight out of the book.
No idea why it doesn't work - even tried full server path with no result.
cheers - Ted
Posted by admin (Graham Ellis), 6 June 2005Some ideas:
a) chmod returns the number of files successfully changed - have you checked the returned value to see whether it thinks it has succeeeded or not? How about all the other special variables that contain error statuses (they're a bit of a mess in Perl 5!)
b) What operating system are you using? What version of Perl? The number given as parameter to "chmod" is Unix / Linux based, and on other operating systems it does its best - the term "moral equivalent" is sometimes used ... but of course it can't set something that's impossible.
c) What user is your script running as? If it's under the control of the web server, then it *may* be as a different user to the command line and the directory permissions may effect things
d) (just noticed this). What's in your $filext variable? Shouldn't it be appended on to the end of the file name in your chmod like it is in your open? In fact -- try this first - I think it's the likely solution.
Posted by TedH (TedH), 7 June 2005Duhhhh!! Well.......
Graham may take out his ruler and rap my knuckles..
..only forgot to have a letter or 2 on the perl script's name didn't I.
Put a couple letters before the $kdate bit and it worked a treat.
It's at http://bluwall.com/td
still a lot of things to do yet but at least I'm getting there.
Posted by admin (Graham Ellis), 7 June 2005All bugs ore obvious once you've found them
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: email@example.com • WEB: http://www.wellho.net • SKYPE: wellho