NAME

Net::LDAP::SimpleServer::LDIFStore - Data store to support Net::LDAP::SimpleServer

VERSION

version 0.0.21

SYNOPSIS

use Net::LDAP::SimpleServer::LDIFStore;

my $store = Net::LDAP::SimpleServer::LDIFStore->new();
$store->load( "data.ldif" );

my $store =
  Net::LDAP::SimpleServer::LDIFStore->new({ ldif => 'data.ldif' });

my $ldif = Net::LDAP::LDIF->new( "file.ldif" );
my $store = Net::LDAP::SimpleServer::LDIFStore->new($ldif);

DESCRIPTION

This module provides an interface between Net::LDAP::SimpleServer and a LDIF file where the data is stored.

As of now, this interface is quite simple, and so is the underlying data structure, but this can be easily improved in the future.

METHODS

new()

Creates a store with no data in it. It cannot be really used like that, you must load() some data with the load() method before being able to use it.

new( FILE )

Create the data store by reading FILE, which may be the name of a file or an already open filehandle. It is passed directly to Net::LDAP::LDIF.

Constructor. Expects either: a filename, a file handle, a hash reference or a reference to a Net::LDAP::LDIF object.

new( HASHREF )

Create the data store using the parameters in HASHREF. The associative-array referenced by HASHREF must contain a key named ldif, which must point to either a filename or a file handle, and it may contain a key named ldif_options, which may contain optional parameters used in the 3-parameter version of the Net::LDAP::LDIF constructor. The LDIF file will be used for reading the data.

new( LDIF )

Uses an existing Net::LDAP::LDIF as the source for the directory data.

load( PARAM )

Loads data from a source specified by PARAM. The argument may be in any of the forms accepted by the constructor, except that it must be specified.

ldif()

Returns the underlying Net::LDAP::LDIF object.

find_tree( (DN|ENTRY) )

Search the store for a subtree, rooted on an entry that has the DN passed, or the DN of the Net::LDAP::Entry object passed. Returns <undef> if not found.

WARNING: this tree reflects the internal data structure of the store, and should not be used lightly. Whenever possible, use find_entry(), exists_dn() or list().

find_entry( (DN|ENTRY) )

Search the store for an entry, based on the DN passed, or the DN of the Net::LDAP::Entry object passed. Returns <undef> if not found.

exists_dn( (DN|ENTRY) )

Boolean version of <find_entry()>

list()

Returns the list of Net::LDAP::Entry objects in the store.

list_with_dn_scope( DN, SCOPE )

Returns a list of Net::LDAP::Entry objects that conforms to the SCOPE applied to a DN, using standard LDAP rules.

SEE ALSO

Please see those modules/websites for more information related to this module.

AUTHOR

Alexei Znamensky <russoz@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 - 2017 by Alexei Znamensky.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

BUGS AND LIMITATIONS

You can make new bug reports, and view existing ones, through the web interface at http://rt.cpan.org.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.