Template::Plugin::LDAP - Handle LDAP queries in TT pages.
# 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 %]
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.
Dominic Mitchell <dom@happygiraffe.net>
Suretec Systems Ltd., Gavin Henry <ghenry@suretecsystems.com<gt>
Net::LDAP(3), Template::Plugin(3), Template::Pluigin::DBI(3).
To install Template::Plugin::LDAP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Plugin::LDAP
CPAN shell
perl -MCPAN -e shell install Template::Plugin::LDAP
For more information on module installation, please visit the detailed CPAN module installation guide.