Post by pitHere my code snippet
$map = Win32::FileOp::Map($drive => $share, {persistent=>0,overwrite=>0});
$drive = "T:"
$share = "\\phlinux\usr2\"
after that $map is undefined.
That's not an actual code snippet that's been run and failed.
I tried a similar script and got undef returned (see below):
------------------------------------------------------------
use strict;
use warnings;
use Win32::FileOp;
my $drive = "T:";
# my $share = "\\phlinux\usr2\"; # not proper quoting
my $share = "//home/dbe";
my $map = Win32::FileOp::Map($drive => $share, { persistent => 0,
overwrite => 0} );
printf "map='%s' GLE='%s' ($^E)\n", $map || 'undef', Win32::GetLastError();
__END__
------------------------------------------------------------
Then I looked at the Map sub and changed line 1432 from:
return;
to:
return $res;
And I got the following output from above script:
map='66' GLE='66' (The network resource type is not correct)
So that looks like a bug.
The problem is I don't have the 0.16.02 version, I have the 0.14.1 version
which appears to have the above bug in it - which you could always change
like I just did.
Check the code in your newer version and see what this part looks like
(starting around line 1423):
if ($res = $Win32::FileOp::WNetAddConnection3->Call( $handle, $struct, $passwd, $username, $options)) {
if (($res == 1202 or $res == 85) and ($opt->{overwrite} or $opt->{force_overwrite})) {
Unmap($disk,{force => $opt->{force_overwrite}})
or return;
$Win32::FileOp::WNetAddConnection3->Call( $handle, $struct, $passwd, $username, $options)
and return;
} elsif ($res == 997) { # Overlapped I/O operation is in progress.
return 1;
} else {
return $res; # line I changed $Bill 1432 - looks like 1581 in 0.16.02
}
}
If it has the same line at what looks like 1581 on CPAN, try changing it like I did
and see what you get. This time use a real test script that has code that actually
was run and failed like mine.