logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: Array Of Hosts: msg#00002

Subject: Re: Array Of Hosts
On 6/7/07 4:34, "CZachary@xxxxxxxxx" <CZachary@xxxxxxxxx> wrote:

> Hello all,
> 
> Could anyone tell me how, I can have my Net LDAP script to use an array of
> hosts, to connect to?
> I tried the following, but it did not work.
> 
> my @hosts = qw(host1, host2);
> 
> my $ldconnect = Net::LDAP->new(@hosts, port=>'389') || die "$@";

RTFP ;-)

---
=item new ( HOST, OPTIONS )

[...]

C<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 C<undef> be
returned.
---

So try:

    Net::LDAP->new(\@hosts, port => 389)

There are a number of other documented ways to call the constructor which
you might find more useful.

Cheers,

Chris






Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>