in reply to Using Win32 network shares

I could never get Win32::NetResource to work for me, but Jenda's Win32::FileOp works like a charm and is embarrsingly easy if you don't mind mapping a drive in the process...

#!perl use Win32::FileOp qw/ Map /; Map 'X:' => ' \\\\machine\\share', { user => 'foo', passwd => 'bar' }; open FILE, 'x:/path/file.ext' or die "...";

    --k.


Replies are listed 'Best First'.
Re: Re: Using Win32 network shares
by John M. Dlugosz (Monsignor) on Apr 05, 2002 at 19:55 UTC
    Yea, that's certainly a much more usable function. The parameters and form make sense on a cold reading, and a short description fully describes the options.

    I'll have to look into the other things in his suite.

    But, I specifically don't want to map a drive letter. That would peturb the user's system, it would have to find the letter that wasn't being used already (his function can use "next available" but doesn't return what it chose), etc.

      "(his function can use "next available" but doesn't return what it chose), etc."

      Yes it does. From his doc

      $drive = Map $share;

      Don't forget that NetResource can do a deviceless connection. You would need to use the UNC to get to the share. That was explained on p62. where it pointed out

      my %NetResource = ( LocalName => "R:", RemoteName => "\\\\Public\\Depot" );

      Remember it said if LocalName was left blank.....