Do this when setting perms for a file or directory:

## Your code slightly modified
use Win32::Perms;

## Begin Add
$FileSystemObject = 'd:/ccs';

if (-d ($FileSystemObject)) {
        my $perms = new Win32::Perms($FileSystemObject) || die "Unable to create 
object";
else {
        my $perms = new Win32::Perms() || die "Unable to create object";
}
## End Add

# COMMENTED # my $perms = new Win32::Perms || die "Unable to create object";

$perms->Allow('Martin', FULL, CONTAINER_INHERIT_ACE);
$perms->Allow('Martin', FULL, OBJECT_INHERIT_ACE | INHERIT_ONLY_ACE);

$perms->Dump;

## Begin Add
if (-d ($FileSystemObject)) {
        $Result = $perms->Set();
else {
        $Result = $perms->Set(#FileSystemObject);
}
## End Add

# COMMENTED # if ($perms->Set('d:/ccs'))
if ($Result ) ## Changed
        {
                print "permissions set OK";
        }
else
        {
                print "Failed";
        }

Dax

*********** REPLY SEPARATOR  ***********

On 10/9/2002 at 12:18 PM Martin Wheldon wrote:

>Hi,
>
>I've posted my actual code now to cut down on typos from my previous
>posting.
>
>#################### This code works ie changes permissions on
>file###########################
>
>use strict 'vars';
>use Win32::Perms;
>
>my $perms = new Win32::Perms || die "Unable to create object";
>$perms->Allow('Martin', FULL, CONTAINER_INHERIT_ACE);
>$perms->Allow('Martin', FULL, OBJECT_INHERIT_ACE | INHERIT_ONLY_ACE);
>
>$perms->Dump;
>
>if ($perms->Set('d:/ccs/test.txt'))
>       {
>               print "permissions set OK";
>       }
>else
>       {
>               print "Failed";
>       }
>
>#################### This code fails ie attempt to change directory
>permissions ###########################
>
>use strict 'vars';
>use Win32::Perms;
>
>my $perms = new Win32::Perms || die "Unable to create object";
>$perms->Allow('Martin', FULL, CONTAINER_INHERIT_ACE);
>$perms->Allow('Martin', FULL, OBJECT_INHERIT_ACE | INHERIT_ONLY_ACE);
>
>$perms->Dump;
>
>if ($perms->Set('d:/ccs'))
>       {
>               print "permissions set OK";
>       }
>else
>       {
>               print "Failed";
>       }
>
>Any help with this is much appreciated.
>Many thanks for your previous quick responses.
>
>Regards
>
>Martin Wheldon
>
>_______________________________________________
>Perl-Win32-Admin mailing list
>[EMAIL PROTECTED]
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to