[EMAIL PROTECTED] wrote:
>
> Hello,
>
> I need a script that runs under Unix and Win32. In this script I check
> some rights/permissions of files/directories.
>
> With unix the tests -r [FILE] -w [FILE] give the expected results, but
> not on win32.
What makes you think so ? What do you get ?
This works fine for me (but I'm using FAT32 FS, so everything is pretty much
writeable - an NTFS FS would be a better choice for a test) :
use strict;
foreach (@ARGV) {
if (-w $_) {
print "Is writeable '$_'\n";
} else {
print "Not writeable '$_'\n";
}
if (-r $_) {
print "Is readable '$_'\n";
} else {
print "Not readable '$_'\n";
}
}
__END__
It fails only when I give it a bad path/non-existent file since I have
admin perms. When I try a CD-ROM file, I get readable, but not writeable
since you can't write to a CD-ROM.
> Any examples for win32 would be greatly appreciated. Please extend my
> function:
>
> sub isWritable {
> my $ret;
> if ( $ostype eq 'unix' ) {
> $ret=-w $_[0];
> }
> else { # win
> ???
> }
> $ret;
> }
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs