--On Wednesday, November 26, 2008 2:30 PM -0600 Christopher A Bongaarts <[EMAIL PROTECTED]> wrote:

In the immortal words of Quanah Gibson-Mount:
According to the Net::LDAP documentation:

new ( HOST, OPTIONS )

HOST may also be a reference to an array of hosts, host-port pairs or
URIs  to try. Each will be tried in order until a connection is made.
Only when  all have failed will the result of undef be returned.
[...]
 $ldap_url = [EMAIL PROTECTED];
 print "LDAP URL is now $ldap_url\n";
 $ldap=Net::LDAP->new("$ldap_url");

Should be checking that $ldap is defined here to avoid the error ;)

Yeah, but first I want things to just work. :P

LDAP URL is now ARRAY(0x1a3752c0)

And since you're passing an array referenced *interpolated into a
string*, this will fail unless your LDAP server's hostname happens to
be "ARRAY(0x1a3752c0)".

<http://www.perl.com/doc/manual/html/pod/perlref.html>

References can be created in several ways.

  1. .

By using the backslash operator on a variable, subroutine, or value. (This works much like the & (address-of) operator in C.) Note that this typically creates ANOTHER reference to a variable, because there's already a reference to the variable in the symbol table. But the symbol table reference might go away, and you'll still have the reference that the backslash returned. Here are some examples:

         $scalarref = \$foo;
         $arrayref  = [EMAIL PROTECTED];
         $hashref   = \%ENV;
         $coderef   = \&handler;
         $globref   = \*foo;

I submit it is a reference to an array, at least according to the documentation from the Perl website.

In any case, if I change the code to be a pure reference, I still get the same problem:

 $ldap=Net::LDAP->new("[EMAIL PROTECTED]");

Now, if I switch back to just a single URI, things work just fine:

LDAP URL is ldap://freelancer.lab.zimbra.com:389

Why this prints a string instead of the ARRAY(xxx) I can't figure out.

Because I commented the array bits out and just left it a plain string on a single value. ;)

--Quanah

--

Quanah Gibson-Mount
Principal Software Engineer
Zimbra, Inc
--------------------
Zimbra ::  the leader in open source messaging and collaboration

Reply via email to