From: Chris B. <bri...@po...> - 2000-10-11 19:54:31
|
I've noticed some behavior that I didn't expect with Net::LDAP::LDIF::write_cmd. I don't know if this is a bug or planned, but it caught me off guard. It seems that write_cmd causes a fatal error if called on an entry that has not been changed. E.g. I'm iterating over a bunch of entries, making changes if they are necessary, and writing out an LDIF file which represents the change with: Net::LDAP::LDIF->new(\*LDIF_FINAL)->write_cmd($entry); If $entry has *not* been changed, my program dies with: ,---- | Can't use an undefined value as an ARRAY reference at /usr/lib/perl5/site_perl/5.005/Net/LDAP/Entry.pm line 278. `---- That's the changes subroutine: ,---- | sub changes { | @{shift->{'changes'}} | } `---- An entry which is returned from a search and not changed does not have a changes key, and thus the above routine dies. I can easily work around this by keeping track of whether I modify the entry or not and only call write_cmd if it's been modified ... but this behavior was very unexpected to me. Should'nt write_cmd simply not write anything out if there is nothing to change? Thanks. |