in reply to Checking Windiows Drive exception.
I use the following code to suppress "Media not inserted" messageboxes:
BEGIN { if ($^O =~ /\bMSWin32\b|\bcygwin\b/) { require Win32::API; Win32::API->import(); Win32::API->Import('kernel32', 'SetErrorMode', 'I', 'I'); my $errormode = SetErrorMode(1); # fetch old error mode SetErrorMode(1 | $errormode); # no AbortRetryFail messages any +more }; };
Your code has two serious bugs in it already. First, you are not using strict.pm, which is why your typo of $drive and $dive will go unnoticed by Perl. Second, you are using backslashes in a double quoted string. \a in a double-quoted string means the "bell" character. Please see perlop on quotes.
|
|---|