Re: Problem with adding a connection with Win32::NetResource



On Dec 28, 5:55 am, chas.ow...@xxxxxxxxx (Chas. Owens) wrote:

You are not using the strict pragma (this doesn't effect your current
problem, but it is still a bad idea).

Like I said, I'm new to Perl. By "pragma" I guess you mean syntax?

It also looks (based on the answer to your second question) like X: is
not a valid name.  Is it possible that you have already mapped a drive
to X:?

Of course not :) I'm new to Perl, not computers. :)

2. Where can I find the error codes and their meanings?

I would suggest consulting the oracle:http://www.google.com/search?q=smb+error+code+1200

From that search I learned the 1200 means "The specified device name
is invalid."

The unavoidable Google :)) Of course, how stupid of me. But why smb in
the query?

I played with the program a bit more, and first got error code of 66
(the network resource type is not correct) and the modified program
(see below) now gives me code 53 (the network path was not found). I
also tried playing with Scope, Type etc. to no avail.

I still don't know what I'm doing wrong :(

-----------------------------------------------------------------------------------------------------
#!/usr/bin/perl -w
use Win32::NetResource;

$RemoteShare = {
# 'Scope' => RESOURCE_CONNECTED,
# 'Type' => RESOURCETYPE_DISK,
# 'DisplayType' => RESOURCEDISPLAYTYPE_SHARE,
# 'Usage' => RESOURCEUSAGE_CONTAINER,
'LocalName' => "X:",
'RemoteName' => "\\\\Nash",
};

$UserName = "No Name";
$Password = "";
$Connection = 1;

Win32::NetResource::AddConnection($RemoteShare,$Password,$UserName,
$Connection)
or print "unable to add Nash\n";

Win32::NetResource::GetError( $ErrorCode );
print "Error code is $ErrorCode \n";
$ErrorCode = oct $ErrorCode if($ErrorCode =~ /^0/);
print Win32::FormatMessage $ErrorCode;
-------------------------------------------------------------------------------------------------

.



Relevant Pages

  • [FreeBSD] Einige der Ports lassen sich nicht bauen. :-(
    ... Einige Sachen ließen sich ohne Probleme bauen und installieren, ... Postfix will Perl 5.8 haben und das mache ich immer ... *** Error code 1 ... FAILED at test 10 ...
    (de.comp.os.unix.bsd)
  • Re: lexical declaration (my) with statement modifier (if)
    ... > In brief, the if or unless has no effect at compile time; any further> mention of the lexical in that scope will compile as a reference to> that lexical, not to some outer lexical or a package variable. ... > Lexicals are initially allocated before runtime, and are cleared for> reuse upon leaving a scope. ... statement modifier to a lexical declaration, ... Our code runs on Perl 5.005 to 5.8.4 on ...
    (comp.lang.perl.moderated)
  • Re: Newbies guide to Stross, Busiek, Watt-Evans, et. al.
    ... array context is, I think, more important to Perl proficiency than ... deallocated when context changes and no references remain). ... I'd say "local" means global scope but dynamic lifetime; ...
    (rec.arts.sf.written)
  • Re: Lack of binary compatibility between VC++ versions?
    ... >> With similar mechanizm you can define some keyword or option for ... You could use JScript or Perl. ... I know Perl can return an error code (the ...
    (microsoft.public.vc.language)
  • Workaround needed. Re: Re: perl DBI 1.25 not connectting to Oracle 10g
    ... IS THERE A WORKAROUND to get this installed with 32 bit perl? ... *** Error code 1 ... >> use DBI; ... >> i install DBD:Oracle as well? ...
    (perl.dbi.users)