how the hell can I pass @ARGV values to the perms add command as constants?

the question you should be asking is: how can i convert @ARGV values to constants for use with the add command?

i haven't tested this, but it *looks* right...

#!/usr/bin/perl require 5.006; use strict; use warnings; $|++; use Win32::Perms; ## takes directory path and permissions as args my( $path, @requested_perms ) = @ARGV; my $dir = Win32::Perms::new( $path ) || die $!; print "\nPath: " . $dir->Path(); ## map args to valid ace permissions ## found at http://www.roth.net/perl/perms/#Table1 my %args_to_perms = ( READ => READ, WRITE => WRITE, FULL => FULL, ALL => ALL, CHANGE => CHANGE, DELETE => DELETE, EXECUTE => EXECUTE, NO_ACCESS => NO_ACCESS, ); ## build full perms list my $perms; $perms |= $args_to_perms{$_} for @requested_perms; ## add access control entry $dir->Allow( 'MYDOMAIN\bloggJo', $perms, ACCESS_ALLOWED_ACE_TYPE, OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE ); $dir->Set() ? print "\nDone\n"; : print "\nFailed\n";
Update: looks likeBrowserUK beat me to it. well, at least i've given you a start on taking variable params from the command-line...

~Particle *accelerates*


In reply to Re: Perms Perms Perms by particle
in thread Perms Perms Perms by blackadder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.