You can use Win32API::File (which should be included with most versions of Perl) to control this. See the module's documentation on SetErrorMode. Since the API is rather broken (Microsoft's fault), here is a sample usage:
Note that this example uses opendir rather than reading the output of "dir /od a:" which can often be a better idea. - tye (but my friends call me "Tye")#!/usr/bin/perl -w use strict; use Win32API::File qw(:ALL); { my $mode= SetErrorMode( 0 ); $mode |= SEM_FAILCRITICALERRORS; SetErrorMode( $mode ); } opendir( DIR, "a:/" ) or die "Can't read directory from a:/; $!\n"; my @files= readdir(DIR); closedir(DIR);
In reply to (tye)Re: Detecting drive unavailability on ActivePerl
by tye
in thread Detecting drive unavailability on ActivePerl
by InfiniteSilence
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |