koha-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Koha-devel] chmod


From: Matthew Hunt
Subject: Re: [Koha-devel] chmod
Date: Thu Jul 3 00:08:30 2003
User-agent: Mutt/1.4.1i

On Wed, Jul 02, 2003 at 11:39:17PM -0700, D Belden K Lyman IV wrote:
> Removing oct() would be a micro-optimisation at best, and could
> potentially introduce a hard-to-track-down bug:
> 
>    1.    my $mode = 0644 ;
>          chmod( $mode, $file );
> 
>    2.    chmod( '0644', $file );
> 
>    3.    chmod( 0644, $file );
> 
> You need oct() in the first 2 cases.
> 
> dbkliv
> 
> [1] - http://www.perldoc.com/perl5.8.0/pod/func/chmod.html

The manpage that you refer to explicitly contradicts what you say
above:

 $mode = '0644'; chmod $mode, 'foo';      # !!! sets mode to --w----r-T
 $mode = '0644'; chmod oct($mode), 'foo'; # this is better
 $mode = 0644;   chmod $mode, 'foo';      # this is best  

You only need oct() in the second case that you gave.  I mention
this only in the interest of accuracy, I don't want to start an
argument.

Matt.
-- 
Matthew Hunt



reply via email to

[Prev in Thread] Current Thread [Next in Thread]