use Paradoze; my $dh = Opendir( 'drwx', $dir ); # use standard "paranoid" routines while ( my $file = Readdir( 'rwx', $dh ) ) { my $path = "$dir/$file"; # do this anyway rather than expecting same directory!! FileTests( 'rwx', "$dir/$file" ); # process the file } #... Paradoze.pm package Paradoze; # paranoid utilities for windows corporate environments sub Opendir { my ( $mask, $path ) = @_; FileTests( $mask, $path ); opendir my $dh, $path or die "$! for path $path\n"; $dh; } sub Readdir { my ( $mask, $dh ) = @_; # ... } sub FileTests { my ( $mask, $path ) = @_; for my $test ( split( '', $mask ) { eval "( -$test $path )" or FTFatal( $test, $path )"; #... }