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