Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

search result on Net LDAP

by perlknight (Pilgrim)
on Jan 31, 2007 at 03:00 UTC ( [id://597491]=perlquestion: print w/replies, xml ) Need Help??

perlknight has asked for the wisdom of the Perl Monks concerning the following question:

All, I am doing a search with base name of an object which only has attribute. The count method returns 0, I am calling attributes and dn method, it's bomming out with the following error:
Can't call method "dn" on an undefined value at ./query_ldap2.pl line +83, <DATA> line 283.
} elsif ( $result->count() eq 0 ) { my $entry = $result->entry(0); print "********",$entry->dn(),"*********\n"; + #my @pattrs = $entry->attributes; #print "******** @pattrs **********\n"; } else {
Any idea as to why? Thanks.

Replies are listed 'Best First'.
Re: search result on Net LDAP
by ikegami (Patriarch) on Jan 31, 2007 at 03:35 UTC

    There are no entries (count = 0), so why would you expect to get an entry from entry()?

    By the way, use == (not eq) for numerical comparisons.

Re: search result on Net LDAP
by jesuashok (Curate) on Jan 31, 2007 at 04:30 UTC
    } elsif ( $result->count() eq '0' ) { my $entry = $result->entry(0); if ( $entry ) { print "********",$entry->dn(),"*********\n"; + } else { # blah blah blah } #my @pattrs = $entry->attributes; #print "******** @pattrs **********\n"; } else {

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://597491]
Approved by jesuashok
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-25 19:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found