LDAP use with ActivePerl

Posted by djr on 2010-07-02 10:21

I am trying to use ldap with activePerl. I'v studied the one page LDAP URI summary. But how do I actually use it ? Where is a good example ?
This is as good as it gets so far
----------------------------------------------------------
my $uri_string="CN=John Doe,OU=Remote_Users,OU=STL Users,ou=STL1,dc=vis,dc=net";
$uri = URI->new("ldap:$uri_string");
$dn = $uri->dn;
$filter = $uri->filter;
@attr = $uri->attributes;
$scope = $uri->scope;
%extn = $uri->extensions;

#Login distinguished name
# CN=NatSharePoint,CN=Users,OU=DS,DC=vis,DC=net
#starting search directory
# DC=vis,DC=net

$uri->attributes(qw(displayName));
$uri->scope('sub');

my $uri = URI->new("ldap:");
$uri->host("10.200.19.40");
$uri->dn("CN=NatSharePoint,CN=Users,OU=STL1,DC=vis,DC=net");
$uri->filter('(cn=john doe)');
print $uri->as_string,"\n";
-------------------------------------------------
The results are:
-------------------------------------------------
Name "main::scope" used only once: possible typo at ahis_ldap.pl line 17.
Name "main::attr" used only once: possible typo at ahis_ldap.pl line 16.
Name "main::filter" used only once: possible typo at ahis_ldap.pl line 15.
Name "main::extn" used only once: possible typo at ahis_ldap.pl line 18.
Name "main::dn" used only once: possible typo at ahis_ldap.pl line 14.
userid entered = x
ldap://10.200.19.40/CN=NatSharePoint,CN=Users,OU=STL1,DC=vis,DC=net???(cn=john%20doe)
The system cannot find the path specified.
-----------------------------------------
thank you !