Subject: | Win32::FileSecurity test.pl should skip when not NTFS |
The test.pl file for Win32::FileSecurity should use Win32::FsType() to
skip tests rather than fail when the partition is not NTFS. The
attached file is a simple example of how to do so.
I marked this "important" because the effect of test.pl failing is to
prevent other tests from running, which means it's not even possible to
see if all other tests are successful and thus whether installation
should just be forced.
David
Subject: | test.pl |
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use Win32::FileSecurity qw(Get EnumerateRights);
use Win32;
$loaded = 1;
print "ok 1\n";
print STDERR "##### This will work only when files are in NTFS #####\n";
foreach (<*>) {
last unless Win32::FsType =~ /^NTFS/;
next unless -e $_;
my(%hash) = ();
if ( Get( $_, \%hash ) ) {
print STDERR "----- File: $_ -----\n";
while( ($name, $mask) = each %hash ) {
print STDERR "$name:\n\t";
EnumerateRights( $mask, \@happy ) ;
print STDERR join( "\n\t", @happy ), "\n";
}
} else {
print( "Error #", int( $! ), ": $!" ) ;
}
}