Net::LDAP::LDIF -- LDIF reading and writing |
Net::LDAP::LDIF -- LDIF reading and writing
use Net::LDAP::LDIF;
$ldif = Net::LDAP::LDIF->new( ``file.ldif'', ``r'' );
while( $entry = $ldif->read()
) {
# Do things with $entry
}
$ldif->done();
$ldif = Net::LDAP::LDIF->new( $fh, ``r'' ); @entries = $ldif->read();
Net::LDAP::LDIF provides a means to convert between Net::LDAP::Entry objects and LDAP entries represented in LDIF format files. Reading and writing are supported and may manipulate single entries or lists of entries.
As when reading an entire file into memory with perl normally, take into account the possibility of memory use when loading an LDIF file in one go.
MODE defaults to ``r'' for read. You may specify ``w'' to for write+truncate or ``a'' for write+append.
In a similar fashion to the perl <$fh> operator, read will read one entry or the entire file depending on whether it is called in a scalar or array context.
This method signals that the LDIF object is no longer needed. If a file was opened automatically when the object was created it will be closed. This method is called automatically via DESTROY when the object goes out of scope.
$ldif->done();
Graham Barr <gbarr@pobox.com>.
Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap@mail.med.cornell.edu>.
Copyright (c) 1997-2000 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Net::LDAP::LDIF -- LDIF reading and writing |