--- bin/ldap.pl 2008/03/12 23:14:13 5 +++ bin/ldap.pl 2008/03/30 16:58:21 42 @@ -6,28 +6,21 @@ use lib 'lib'; use Jifty; -use Net::LDAP; +use A3C::LDAP; +use Data::Dump qw/dump/; +use Getopt::Long; BEGIN { Jifty->new; }; -my $ldap = Net::LDAP->new( 'ldap1.skole.local' ) or die "$@"; - -# an anonymous bind -my $mesg = $ldap->bind; - -# perform a search -$mesg = $ldap->search( - base => "dc=skole,dc=hr", -# filter => "(&(sn=Barr) (o=Texas Instruments))", - filter => "(objectClass=hrEduPerson)", - sizelimit => 0, # off +my $limit = 100; +GetOptions( + 'limit=i', => \$limit, ); -if ( $mesg->code ) { - warn $mesg->code, ": ", $mesg->error, "\n"; -} +my $ldap = A3C::LDAP->new; -foreach my $entry ( $mesg->entries ) { - $entry->dump; +foreach my $model ( qw/Organization User/ ) { + my $collection = $ldap->collection( $model, $limit ); + Jifty->log->info( "found ", $collection->count, " entries for $model" ); }