1 package LiCoM::Connection;
12 LiCoM::Connection - Represents the connection to an LDAP-server.
16 our %Config = get_config ();
19 @LiCoM::Connection::EXPORT_OK = (qw($Ldap));
20 @LiCoM::Connection::ISA = ('Exporter');
28 =item LiCoM::Connection-E<gt>B<connect> (I<$server>, I<$bind_dn>, I<$password>, I<$base_dn>, [I<$port>])
30 Connects to the LDAP-Server given.
39 my $bind_dn = $opts{'bind_dn'};
40 my $base_dn = $opts{'base_dn'};
41 my $uri = $opts{'uri'};
42 my $passwd = $opts{'password'};
46 die unless ($bind_dn and $base_dn and $uri and defined ($passwd));
48 $Ldap = Net::LDAP->new ($uri);
50 $msg = $Ldap->bind ($bind_dn, password => $passwd);
51 if ($msg->is_error ())
53 warn ('LDAP bind failed: ' . $msg->error_text ());
57 $Config{'base_dn'} = $base_dn;
62 =item LiCoM::Connection-E<gt>B<disconnect> ()
64 Disconnect from the LDAP-Server.
78 Florian octo Forster E<lt>octo at verplant.orgE<gt>