[EMAIL PROTECTED] wrote:
I am looking at how I could connect to share and map a local drive in a
perl script. I have cut and pasted the code from the man page from Lanman
to understand what is happening.

When I run the code below I get the following error

Undefined subroutine &main::USE_IPC called at map.pl line 5.

Am I missing something ?

Cheers

Neill


#!/usr/bin/perl use strict; use warnings; # use win32::Lanman; if(!Win32::Lanman::NetUseAdd({remote => "\\\\server\\ipc\$", password => "pass", username => "user", domain => "NT", asg_type => &USE_IPC}))
^^^^^^^^
The problem is perl interprets the above marked code as: assign the value returned from a call to the subroutine USE_IPC() to the key asg_type. I'm not familiar with the Lanman module, but I'm guessing that is supposed to be a constant. You probably need to either fully qualify the constant (eg Win32::Lanman::USE_IPC) or import the constant into the current namespace (eg use Win32::Lanman (USE_IPC)).



{
 print "Sorry, something went wrong; error: ";
        # get the error code
        print Win32::Lanman::GetLastError();
        exit 1;
        }

#connects drive h: to \\testserver\testshare.

 if(!Win32::Lanman::NetUseAdd({remote => "\\\\testserver\\testshare",
                              local => "h:",
                              asg_type => &USE_DISKDEV}))
 {
        print "Sorry, something went wrong; error: ";
        # get the error code
        print Win32::Lanman::GetLastError();
        exit 1;
 }



Undefined subroutine &main::USE_IPC called at map.pl line 5.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to