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



On Dec 28, 2007 9:45 AM, Nash <lontche@xxxxxxxxx> wrote:
On Dec 28, 5:55am, 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?
snip

Pragmas are "pragmatic instructions". In Perl, they are the lowercase
modules likes strict, bytes, warnings, etc. They alter the way Perl
understands your code. The strict pragma

use strict;

plugs a few holes in the Perl 5 language that have been left open for
backwards compatibility and to aid in the use of perl as a command
line utility (as in perl -ple '$_=y/,//'). Pragmas tend to be
lexically scoped. This means they only have effect inside the block
they are defined in:

my $char = "\x{2603}"; #a Unicode snowman
#out here we use character semantics so the length of $char is 1
my $char_len = length $char;
my $byte_len;
{
use bytes;
#but inside these braces we are using byte semantics due
#to the bytes pragma, so the length is 3 (Unicode U+2603 is
#E2, 98, and 83 in UTF-8)
$byte_len = length $char;
}
#and we are back to character semantics

snip
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:?
snip

Then it is likely there is some other problem with using X: as the
local name; have you tried other drive letters?

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

Hey, I have called tech support for something that wasn't plugged in
before. Well, it was partially plugged in, so it _looked_ plugged in.
Checking assumed facts is part of troubleshooting.

snip
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?
snip

The SMB (aka Server Message Block*) protocol is how Microsoft does
file/print sharing. You may also know it under the name CIFS. There
is also an FOSS implementation named Samba**. Since the error was
related to file sharing it was a handy way of narrowing down the
results.

snip
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 :(
snip
$RemoteShare = {
# 'Scope' => RESOURCE_CONNECTED,
# 'Type' => RESOURCETYPE_DISK,
# 'DisplayType' => RESOURCEDISPLAYTYPE_SHARE,
# 'Usage' => RESOURCEUSAGE_CONTAINER,
'LocalName' => "X:",
'RemoteName' => "\\\\Nash",
};
snip

Hmm, does it still work when all you give it is the RemoteName?

* http://en.wikipedia.org/wiki/Server_Message_Block
** http://us1.samba.org/samba/
.



Relevant Pages

  • Re: Requesting advice how to clean up C code for validating string represents integer
    ... [Java to Lisp] ... [Perl to Lisp] ...
    (comp.lang.c)
  • Re: How to use GUI: Win32::GUI If You Need Accessibility
    ... I will press a key to convert, and it should give me the converted rtf8/unicode text in another text box <snip> ... coming from a win32 api/C/C++ background. ... the exact font metrics that can be used to write resolution, font and DPI independent code in Windows apps. ... Perl will crash consistantly with a highly cryptic error message if you try to use the two at once. ...
    (comp.lang.perl.misc)
  • Re: How to use GUI: Win32::GUI If You Need Accessibility
    ... I will press a key to convert, and it should give me the converted rtf8/unicode text in another text box <snip> ... coming from a win32 api/C/C++ background. ... the exact font metrics that can be used to write resolution, font and DPI independent code in Windows apps. ... Perl will crash consistantly with a highly cryptic error message if you try to use the two at once. ...
    (comp.lang.perl.misc)
  • Re: Ternary operator
    ... to the perl maintainers) is "Where does perl document the ternary ... operator's behaviour of only evaluating either the second or the third ... is the only trinary operator. ...
    (perl.beginners)
  • Re: @array a copy of @names???
    ... It started in the 3rd edition of Learning Perl. ... That's really a foreach loop, ... least) an even worse confusion in the readers mind: ...
    (perl.beginners)