Hi,

On Wednesday, 9. November 2005 17:01, John Parks, SEI Webmaster wrote:
> I tried the dump and got the following error:
>
> Can't call method "dump" on an undefined value at
> /export/web/infolink/cgi/perl/test-get.pl line 34, <DATA> line 225.
>
> I am getting the feeling it's not getting anything back or it doesn't know
> how to read what it's getting back.
>
> The results print out like this:
> Net::LDAP::Search=HASH(0x83460b8)
>
> [ ... lot of stuff deleted ...]
> 
> # Execute the search
> my $results = $ad->search(base=>$searchbase,filter=>$filter,attrs=>$attrs);
>

You do neither check whether the search succeeds nor whether it found
entries. 
To cure it you might try the following directly after performing the search:

die "search failed: ".$results->error()."\n"  if ($results->code);
die "nothing found\n"  if ($results->count() <= 0);

> # Display entries
> my $entry;
>
> $entry = $results->entry(0);
>
> print $entry->get_value('sn').", ".$entry->get_value('givenname')."\n";
> print "Email: ".$entry->get_value('mail')."\n";
>
> [ ... stuff deleted ...]
>
> This is what the results look like:
> Net::LDAP::Search=HASH(0x8345f68)

This is correct: the result is a Net::LDAP::Search object !

> Any suggestions would be greatly appreciated.
Done.

Hope it helps
Peter

-- 
Peter Marschall     |   eMail: [EMAIL PROTECTED]
Scheffelstra�e 15   |   Tel:   +49 931 14721
D-97072 W�rzburg    |
PGP: 0BB1 04A3 0FB0 E27F 8018 52BA A286 7B23 9C22 2C83

Reply via email to