Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Perms Perms Perms

by ozone (Friar)
on Sep 13, 2002 at 10:52 UTC ( #197505=note: print w/replies, xml ) Need Help??


in reply to Perms Perms Perms

I'm not an expert on Win32, or the Win32::Perms module you're using, but something like this should work:

$userPerm is your command line argument

my $flags = $folder_ace|$subfolder_ace, ACCESS_ALL +OWED_ACE_TYPE, OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; if($userPerm eq 'READ') { $flags |= READ; } elsif($userPerm eq 'WRITE') { $flags |= WRITE; } $perms->Add('MYDOMAIN\bloggJo', $flags);

I've kept this verbose for clarity.

Your basic problem is that 'constants' in Perl are actually calls to subroutines, which return a constant value. And as the 'READ' or 'WRITE' arguments from the command line are simply text strings, they aren't then interpreted as constants.

So you need to 'translate' the command line args into calls to the relevant perl 'constants'.

Replies are listed 'Best First'.
Re: Re: Perms Perms Perms
by blackadder (Hermit) on Sep 13, 2002 at 12:29 UTC
    Thanks very much for this.

    But my Command line arguments (i.e. @ARGV) are broken into $folder_ace and $subfolder_ace, so I am a bit confused on where do I obtain $userPerms? @ARGV is an array with two elements in it, the first is the perms type for folder level and the second element is the perms type for sub folder level.

    I appreciate it if you could clear this up for me.

    Regards
    Blackadder

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://197505]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2022-05-28 08:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (99 votes). Check out past polls.

    Notices?