Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-18 21:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found