koha-devel
[Top][All Lists]
Advanced

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

Re: [Koha-devel] chmod


From: D Belden K Lyman IV
Subject: Re: [Koha-devel] chmod
Date: Wed Jul 2 23:40:05 2003
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02


address@hidden wrote:
I think the chmod doesn't need oct if it is given a number, so we should
use chmod 0644, $file; rather than chmod oct(0644), $file;.  Do we have
someone who knows for sure, please?



Both are correct. The specific call to oct() is useful if the mode
is stored in a variable, or is a string.[1]

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




reply via email to

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