You should do some error checking...

#!/usr/bin/perl -w

use strict;
use Getcwd;

my $dir = "cody";
mkdir("$dir",0770) or warn("Could not mkdir $dir in ".getcwd.": $!\n");

This will tell you why or how something might be going wrong and what your 
pwd is.  Also, you should check the parent directory in which you are 
trying to make this directory for directory permissions (seteuid) which can 
cause the directory to be created the same as the parent directory.  You 
should also see if you have a umask set.  If so, this could cause the 
directory to default to a certain mode at first that might cause caveats 
with Perl (doubt it but just brain storming here).

At 10:48 AM 7/7/2001 -0500, [EMAIL PROTECTED] wrote:
>#!/usr/bin/perl -w
>
>use strict;
>
>my $dir = "cody";
>mkdir("$dir",0770);
>
>
>i am running this in my home directory on a linux machine, so i have full
>rights. when i run this however, the permissions on the directory are:
>
>drwxr-x---    2 cmenzes  cmenzes      1024 Jul  7 10:39 cody/
>
>which translates to 0750. i am thinking that this limit may have to do
>with my shell umask setting which is at 022, but i am not certain why it
>is taking precedence over the perl setting. if i change my second argument
>in my mkdir statement to 0660 or 0444, the proper permissions are set. the
>only pattern that i see is that i *can* explicitly set the permissions in
>a mkdir statement if they are more restrictive than my umask. otherwise
>the perms default to my umask.
>i know i can get past this by following the mkdir statement with a chmod,
>but i just wanted to verify that my logic on this one is correct.



- Jim

-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
http://www.perlmonks.org/index.pl?node_id=67861&lastnode_id=67861

-----BEGIN PERL GEEK CODE BLOCK-----      ------BEGIN GEEK CODE BLOCK------
Version: 0.01                             Version: 3.12
P++>*@$c?P6?R+++>++++@$M                  GIT/CM/J d++(--) s++:++ a-
 >++++$O!MA->++++E!> PU-->+++BD            C++++(+) UB++++$L++++$S++++$
$C-@D!>++++(-)$S++++@$X?WP+>++++MO!>+++   P++(+)>+++++ L+++(++++)>+++++$ !E*
+PP+++>++++n-CO?PO!o >++++G               W++(+++) N+ o !K w--- PS---(-)@ PE
 >*(!)$A-->++++@$Ee---(-)Ev++uL++>*@$uB+   Y+>+++ PGP t+(+++)>+++@ 5- X++ R@
 >*@$uS+>*@$uH+uo+w-@$m!                   tv+ b? DI-(+++) D+++(++) G(++++)
------END PERL GEEK CODE BLOCK------      ------END GEEK CODE BLOCK------

Reply via email to