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

NAME

Catalyst::Model::LDAP::Cached - Cached LDAP model class for Catalyst

SYNOPSIS

  # lib/MyApp/Model/People.pm
  package MyApp::Model::People;

  use base 'Catalyst::Model::LDAP::Cached';

  __PACKAGE__->config(
      host         => 'ldap.ufl.edu',
      base         => 'ou=People,dc=ufl,dc=edu',
      dn           => '',
      password     => '',
      options      => {},     # Net::LDAP method options (e.g. SASL
                              # for bind or sizelimit for search)
      cache        => undef,  # Reference to a Cache object (e.g.
                              # Cache::FastMmap) to cache results
  );

  1;

  # In your controller
  my $entries = $c->comp('M::People')->search('(sn=TEST)');
  print $entries->[0]->get_value('sn');

DESCRIPTION

This is the Net::LDAP model class for Catalyst. It is nothing more than a simple wrapper for Net::LDAP.

METHODS

Search the directory using a given filter, but check the configured cache first for a matching filter. Returns an arrayref containing the matching Net::LDAP::Entry objects (if any).

  my $entries = $c->comp('M::People')->search('(sn=TEST)');
  print $entries->[0]->get_value('sn');

_cache

Get and set cache values, if a Cache object is configured. If only a key is specified, return the cached value, if one exists. If a value is also given, set the value in the cache.

SEE ALSO

TODO

  • Cache the LDAP code value and error message?

  • Create Helper class

AUTHOR

Daniel Westermann-Clark <danieltwc@cpan.org>

LICENSE

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