|
Posted by Gunnar Hjalmarsson on March 9, 2008, 6:42 pm
Please log in for more thread options Joost Diepenmaat wrote:
>
>>>> open(TEKST,">test.txt") or die $!;
>>>> chmod 0600,*TEKST or die $!;
>>>> binmode(TEKST);
>>>> print TEKST "hello world";
>>>> close TEKST;
>
> [ ... ]
>
>> Did you check the return value from chmod() as suggested? When I run
>> the code as above, I got a "No such file or directory" error
>> message.
>
> AFAIK the code as posted above should work in systems that support
> fchmod() - basically any recent Unix - and should generate a fatal error
> at line 2 on systems that don't.
>
> Whatever it does it should never give a "No such file or directory
> error". At least not at line 2.
$ cat test.pl
print "$^O\n";
open(TEKST,">test.txt") or die $!;
chmod 0600,*TEKST or die $!;
$ perl test.pl
linux
No such file or directory at test.pl line 3.
$ ls -l test.txt
-rw-rw-r-- 1 gunnarh gunnarh 0 Mar 9 18:42 test.txt
$
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
|