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", onerror => 'undef' ); while( not $ldif->eof ( ) ) { $entry = $ldif->read_entry ( ); if ( $ldif->error ( ) ) { print "Error msg: ", $ldif->error ( ), "\n"; print "Error lines:\n", $ldif->error_lines ( ), "\n"; } else { # do stuff } } $ldif->done ( );
Net::LDAP::LDIF provides a means to convert between the Net::LDAP::Entry manpage 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.
FILE
may be the name of a file or an
already open filehandle. If FILE
begins or ends with a |
then
FILE
will be passed directly to open
.
MODE
, eg ``w'' or ``a''. FILE
may be
the name of a file or an already open filehandle. If FILE
begins or
ends with a |
then FILE
will be passed directly to open
.
Net::LDAP::LDIF
will croak with an appropriate message.
Net::LDAP::LDIF
will warn with an appropriate message.
Net::LDAP::LDIF
will warn with an appropriate message if -w
is
in effect. The method that was called will return undef
.
According to RFC 2849 currently the only legal value for this option is 1.
When this option is set Net::LDAP::LDIF tries to adhere more strictly to the LDIF specification in RFC2489 in a few places.
The default is undef meaning no version information is written to the LDIF file.
Default is 78. Setting it to 40 or lower inhibits wrapping.
When running on Perl 5.8 and this option is given Net::LDAP converts all values of attributes not matching this REGEX into Perl UTF-8 strings so that the regular Perl operators (pattern matching, ...) can operate as one expects even on strings with international characters.
If this option is not given or the version of Perl Net::LDAP is running on is too old strings are encodeed the same as in earlier versions of perl-ldap.
Example: raw => qr/(?i:^jpegPhoto|;binary)/
Net::LDAP::Entry
object.
If not called explicitely, it gets called automatically when writing the first entry.
According to RFC 2849 currently the only legal value for VERSION is 1.
Net::LDAP::LDIF
object reads fromi
or writes to.
Net::LDAP::Entry
object.
Net::LDAP::Entry
object.
Net::LDAP::Entry
object.
Graham Barr <gbarr@pobox.com>.
Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap@perl.org>.
Copyright (c) 1997-2004 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 |