Click here to get back home

Setting chmod

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Setting chmod John 03-09-2008
---> Re: Setting chmod Joost Diepenmaa...03-09-2008
Posted by Ben Morrow on March 9, 2008, 7:41 pm
Please log in for more thread options

>
> > Why is the test.txt not chmodded to 0600 but to 0755
>
> Because $sec is not a file name or a file handle. It's a good idea to
> check if any file operation succeeded:
>
> open(TEKST,">test.txt") or die $!;
> chmod 0600,*TEKST or die $!;

Don't use bare globs unless you really have to. They're very magic, and
it's always safer to use a globref when you can:

chmod 0600, \*TEKST or die $!;

Of course, a lexical filehandle would be better again.

Ben


Posted by Abigail on March 10, 2008, 4:35 am
Please log in for more thread options
_
Ben Morrow (ben@morrow.me.uk) wrote on VCCCIV September MCMXCIII in
**
** >
** > > Why is the test.txt not chmodded to 0600 but to 0755
** >
** > Because $sec is not a file name or a file handle. It's a good idea to
** > check if any file operation succeeded:
** >
** > open(TEKST,">test.txt") or die $!;
** > chmod 0600,*TEKST or die $!;
**
** Don't use bare globs unless you really have to. They're very magic, and
** it's always safer to use a globref when you can:
**
** chmod 0600, \*TEKST or die $!;


So, in which way is 'chmod 0600, *TEKST' unsafe?

And why didn't you perlbug it?



Abigail
--
# Count the number of lines; code doesn't match \w. Linux specific.
()=<>;$!=$=;($:,$,,$;,$")=$!=~/.(.)..(.)(.)..(.)/;
$;++;$*++;$;++;$*++;$;++;`$:$,$;$" $. >&$*`;

Similar ThreadsPosted
chmod for directories August 9, 2004, 2:22 pm
Problems with chmod February 28, 2006, 6:23 pm
Recursive chmod/chown February 3, 2006, 10:46 am
ExtUtils chmod on Windows? August 10, 2007, 8:57 am
setting uid gid after fork August 28, 2007, 3:35 am
setting %ENV in a module February 20, 2008, 7:59 pm
Re: Setting up mod_perl March 10, 2008, 2:50 pm
Re: Setting up mod_perl March 11, 2008, 11:17 pm
Net::DNS-> About setting more than one nameserver to lookup. August 7, 2004, 9:05 pm
setting cookies (mod_perl) October 14, 2004, 9:15 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap