http://qs321.pair.com?node_id=785092


in reply to DBMS and network drive

This is pretty easy really - you just open the file using the UNC.

Basically, opening a file on a network drive can be accomplished by using the UNC filepath:

my $unc = '//10.1.0.22/path/to/use'; open(my $fh, $unc) or die "[Error] COULD NOT OPEN FILE: [$unc] - [$!]" +;

If you need to connect to the network drive you have two options.

One option is to create a mapped drive.

You could do this directly through Windows using the NET USE command:

net use x: \\computer name\share name
or
net use x: \\computer name\share name password /user:username
or a permanent map
net use x: \\computer name\share name password /user:username /persist +ent:yes

You could also accomplish this same thing using Win32::FileOp by using the Map routine:

my $drive = 'X'; my $unc = '//10.1.0.22/path/to/use' my $user = 'user'; my $pass = 'xyz'; Map $drive => $unc, { username => $user, passwd => $pass };

Finally, the second option is to connect to the network drive directly in the program which can be accomplished by using the Win32::FileOp Connect routine:

my $drive = 'X'; my $unc = '//10.1.0.22/path/to/use' my $user = 'user'; my $pass = 'xyz'; Connect $drive => $unc, { username => $user, passwd => $pass };