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

NAME

Template::Plugin::LDAP - Handle LDAP queries in TT pages.

SYNOPSIS

    # Bind anonymously.
    [% USE LDAP('ldap.lan') %]
    # Authenticate.
    [% USE LDAP('ldap.lan', 'user', 'password') %]

    # Connect explicitly
    [% USE LDAP %]
    [% LDAP.connect('ldap.lan') %]

    [% FOREACH entry = LDAP.search( base = 'dc=myco,dc=com',
                                    filter = '(objectClass=person)',
                                    attrs = [ 'email', 'cn' ] ) %]
       Distinguished Name Is [% entry.dn %]
       Email: [% entry.cn %] <[% entry.email %]>
    [% END %]

DESCRIPTION

This is a plugin for the Template Toolkit to do LDAP queries. It does not do updates. Mostly, it is similiar in design to the DBI plugin, except where I copied it wrong. :-)

Basically, pass in a hostname and optionally a username/password to the constructor.

To do a search, you need to specify at least base and filter arguments to the search method, but have a look at Net::LDAP(3) (the search method) because that is what is being used underneath and there are quite a few options.

The entries that you get back from the search are at present very simplistic and really only meant for display purposes only. If I need to do updates later, that functionality might be added.

METHODS

new

connect

get_first

get_next

get

get_all

dn

AUTHOR

Dominic Mitchell <dom@happygiraffe.net>

MAINTAINER

Suretec Systems Ltd., Gavin Henry <ghenry@suretecsystems.com<gt>

SEE ALSO

Net::LDAP(3), Template::Plugin(3), Template::Pluigin::DBI(3).