Dear,

I'm a newbie of perl-ldap. After the module Net::LDAP 0.32 had been installed 
successfully, I downloaded a testing script from the search.cpan.org example:

[Quote]

#!/usr/bin/perl -w

 use Net::LDAP;

 $ldap = Net::LDAP->new ( "ldap.bigfoot.com" ) or die "$@";

 $userToAuthenticate = "scott";

 $passwd = "123456";

 $mesg = $ldap->bind ( version => 3 );          # use for searches

 $mesg = $ldap->bind ( "$userToAuthenticate",           
                       password => "$passwd",
                       version => 3 );          # use for changes/edits

 sub LDAPsearch
 {
   my ($ldap,$searchString,$attrs,$base) = @_;

   # if they don't pass a base... set it for them

   if (!$base ) { $base = "o=mycompany, c=mycountry"; }

   # if they don't pass an array of attributes...
   # set up something for them

   if (!$attrs ) { $attrs = [ 'cn','mail' ]; }

   my $result = $ldap->search ( base    => "$base",
                                scope   => "sub",
                                filter  => "$searchString",
                                attrs   =>  $attrs
                              );

}

 my @Attrs = ( );               # request all available attributes
                                # to be returned.

 my $result = LDAPsearch ( $ldap, "sn=*", [EMAIL PROTECTED] );

 #------------
 #
 # Accessing the data as if in a structure
 #  i.e. Using the "as_struct"  method
 #

 my $href = $result->as_struct;

 # get an array of the DN names

 my @arrayOfDNs  = keys %$href;        # use DN hashes

 # process each DN using it as a key

 foreach ( @arrayOfDNs ) {
   print $_, "\n";
   my $valref = $$href{$_};

   # get an array of the attribute names
   # passed for this one DN.
   my @arrayOfAttrs = sort keys %$valref; #use Attr hashes

   my $attrName;        
   foreach $attrName (@arrayOfAttrs) {

     # skip any binary data: yuck!
     next if ( $attrName =~ /;binary$/ );

     # get the attribute value (pointer) using the
     # attribute name as the hash
     my $attrVal =  @$valref{$attrName};
     print "\t $attrName: @$attrVal \n";
   }
   print "#-------------------------------\n";
   # End of that DN
 }
 #
 #  end of as_struct method
 #
 #--------

[/Quote]

When I ran the script in the host (AIX 5.2), it gave the following error:

IO::Socket::INET: connect: A socket operation is already in progress. at 
./test_ldap_1.pl line 5, <DATA> line 225.

How to fix the problem? Please help. Thanks.

Charles

A little [EMAIL PROTECTED]

Reply via email to