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 };


In reply to Re: DBMS and network drive by tokpela
in thread DBMS and network drive by hnd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.