I have a "dumpuser" script that would dump an LDAP user entry.
Recently, we've added some new data which is binary and as a result,
sometimes my shell crashes when I try to dump a user.
I may not be taking the right approach to this, but I decided after
reading the docs that the right thing to do is use LDAP::LDIF to
generate a customized printout to a file, then print the file contents.
If there's a better way, please let me know.
So I ran the modified script but I get this error:
Can't locate object method "write_entry" via package "Net::LDAP::LDIF"
Here's most of the full code:
use ldaputils #my ldap management utility
use Net::LDAP::LDIF;
my $user = "rglasser";
my $file = "./foo";
my $ldap = getldap(); # runs ldap open routine
my $mesg = $ldap->search ( ... );
# parameters include passing the
# username (search routine is known to
# work from previous version)
my $ldif = Net::LDAP::LDIF->new($file, "w", onerror => 'die');
foreach my $entry($mesg->all_entries) {
$ldif->write_entry($entry);
}
$ldif->done();
As I said before, it generates a failure on the line with write_entry.
I checked the $ldif handle and it does correctly contain a
Net::LDAP::LDIF object.
Can anyone shed some light on this matter?