The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

VERSION

This document describes Net::LDAP::SimpleServer::LDIFStore version 0.0.4

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

    my $result = $store->filter( sub {
      $a = shift;
      $a->get_value('cn') =~ m/joe/i;
    } );

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.

CONSTRUCTOR

new()

Creates a store with no data in it. It cannot be really used like that, you must load() some data in it first.

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.

METHODS

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.

filter( SUBREF )

Returns a list of entries for which the function referenced by SUBREF returns true.

CONFIGURATION AND ENVIRONMENT

Net::LDAP::SimpleServer requires no configuration files or environment variables.

DEPENDENCIES

UNIVERSAL::isa

Scalar::Util

Net::LDAP::LDIF

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

This store does not yet support writing to a LDIF file, which makes the Net::LDAP::SimpleServer a read-only server.

No bugs have been reported.

Please report any bugs or feature requests to bug-net-ldap-simpleserver@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Alexei Znamensky <russoz@cpan.org>

LICENCE AND COPYRIGHT

Copyright (c) 2010, Alexei Znamensky <russoz@cpan.org>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

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.