In the immortal words of Manuel Vacelet:
> 4 my @servers =
> ['ldap://ldap5.example.com','ldap://ldap-fallback-eu.example.com','ldap://ldap.example.com','ldap://ldap2.example.com'];
> 5 my $ldap = Net::LDAP->new(@servers) or die "Unable to connect to
> ldap server: [EMAIL PROTECTED]";
>
> But, if I change [] by () in the servers array affectation L4, I get an error:
> Unable to connect to ldap server: IO::Socket::INET: Bad hostname ''
When you use the [], what you end up with is a list @servers with a
single element that is itself a reference to the list of ldap URLs:
$servers[0] = ['ldap...',...]
When you change to (), the list @servers is just a plain list:
$servers[0] = 'ldap5...';
$servers[1] = 'ldap-fallback....';
...
To get the multi-server list in Net::LDAP-new, you need to pass in a
list reference. Using @servers in the first case works because the
list you pass happens to contain a list reference as its first (and
only) element.
What you really want (based on your "what I got from the config" comment):
my @servers = ('ldap5...', 'ldap-fallback...');
my $ldap = Net::LDAP->new([EMAIL PROTECTED]) or die...
The backslash in front of @servers makes a reference to the list.
%% Christopher A. Bongaarts %% [EMAIL PROTECTED] %%
%% Internet Services %% http://umn.edu/~cab %%
%% University of Minnesota %% +1 (612) 625-1809 %%