Manpages

Manpage of LDIF

LDIF

Section: User Contributed Perl Documentation (1)
Updated: 2001-08-21
Index
Return to Main Contents
 

NAME

Net::LDAP::LDIF - LDIF reading and writing  

SYNOPSIS

  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();


 

DESCRIPTION

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.  

CONSTRUCTOR

new ( [ FILE [, MODE [,OPTIONS ]]] )
FILE may be the name of a file or an already open filehandle. If a filename is passed in then it will be opened with the mode specified.

MODE defaults to ``r'' for read. You may specify ``w'' to for write+truncate or ``a'' for write+append.

OPTIONS is a list of key-value pairs. Valid options are:

encode
Some values in LDIF cannot be written verbatim and have to be encoded in some way. This option lets you specify how. Valid encoding options are 'none' (the default), 'canonical' (see ``canonical_dn'' in Net::LDAP::Util), or 'base64'.
onerror
If set then Net::LDAP::LDIF will check all responses for errors on all methods. If an error is detected then the specified action will be taken. Valid values and their actions are.
die
Net::LDAP::LDIF will croak with an appropriate message.
warn
Net::LDAP::LDIF will warn with an appropriate message.
undef
Net::LDAP::LDIF will warn with an appropriate message if "-w" is in effect. The method that was called will return "undef"
 

METHODS

read_entry
Read one entry from the file and return it as a Net::LDAP::Entry object.
eof
Returns true when the end of the file is reached.
write_entry ( ENTRIES )
done
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.
error
Returns error message if error was found.
error_lines
Returns lines that resulted in error.
current_entry
Returns the current Net::LDAP::Entry object.
current_lines
Returns the lines that generated the current Net::LDAP::Entry object.
next_lines
Returns the lines that will generate the next Net::LDAP::Entry object.
 

AUTHOR

Graham Barr <gbarr@pobox.com>.

Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap-dev@lists.sourceforge.net>.  

COPYRIGHT

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.


 

Index

NAME
SYNOPSIS
DESCRIPTION
CONSTRUCTOR
METHODS
AUTHOR
COPYRIGHT

This document was created by man2html, using the manual pages.
Time: 08:52:22 GMT, March 28, 2024