1Catalyst::Model::LDAP::UEsnetrryC(o3n)tributed Perl DocuCmaetnatlaytsito:n:Model::LDAP::Entry(3)
2
3
4
6 Catalyst::Model::LDAP::Entry - Convenience methods for Net::LDAP::Entry
7
9 version 0.21
10
12 # In your controller
13 my $mesg = $c->model('Person')->search('(cn=Lou Rhodes)');
14 my $entry = $mesg->shift_entry;
15 print $entry->title;
16
18 This module simplifies use of Net::LDAP::Entry objects in your
19 application. It makes accessors and mutators for all attributes on an
20 entry. For example:
21
22 print $entry->cn;
23
24 It also stores a reference to the parent LDAP connection, simplifying
25 updates to the entry:
26
27 $entry->title('Folk singer');
28 $entry->update;
29
31 If you want to provide your own methods on an LDAP entry, you can use
32 the "entry_class" configuration variable. For example:
33
34 # In lib/MyApp/Model/LDAP.pm
35 package MyApp::Model::LDAP;
36 use base qw/Catalyst::Model::LDAP/;
37
38 __PACKAGE__->config(
39 # ...
40 entry_class => 'MyApp::LDAP::Entry',
41 );
42
43 1;
44
45 # In lib/MyApp/LDAP/Entry.pm
46 package MyApp::LDAP::Entry;
47 use base qw/Catalyst::Model::LDAP::Entry/;
48 use DateTime::Format::Strptime;
49
50 sub get_date {
51 my ($self, $attribute) = @_;
52
53 my ($datetime) = ($self->get_value($attribute) =~ /^(\d{14})/);
54
55 my $parser = DateTime::Format::Strptime->new(
56 pattern => '%Y%m%d%H%M%S',
57 locale => 'en_US',
58 time_zone => 'UTC'
59 );
60
61 return $parser->parse_datetime($datetime);
62 }
63
64 1;
65
67 new
68 Override the Net::LDAP::Entry object constructor to take an optional
69 LDAP handle. If provided this will be used automatically on "update".
70
71 update
72 Override "update" to default to the optional LDAP handle provided to
73 the constructor.
74
75 can
76 Override "can" to declare existence of the LDAP entry attribute methods
77 from "AUTOLOAD".
78
80 · Catalyst::Model::LDAP
81
82 · Catalyst::Model::LDAP::Search
83
85 · Marcus Ramberg
86
88 This library is free software; you can redistribute it and/or modify it
89 under the same terms as Perl itself.
90
92 Gavin Henry <ghenry@surevoip.co.uk>
93
95 This software is copyright (c) 2017 by Gavin Henry.
96
97 This is free software; you can redistribute it and/or modify it under
98 the same terms as the Perl 5 programming language system itself.
99
100
101
102perl v5.32.0 2020-07-28 Catalyst::Model::LDAP::Entry(3)