- SEE ALSO
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 <email@example.com>
Suretec Systems Ltd., Gavin Henry <firstname.lastname@example.org<gt>
Net::LDAP(3), Template::Plugin(3), Template::Pluigin::DBI(3).