blib/lib/Kolab/LDAP/Backend/dirservd.pm

filter: Statementstmt 81.8% 9 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 86.6% 13 / 15 CC 1 SCAR 0.7
CC
1
Cov
82%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
↑ Summary
1 package Kolab::LDAP::Backend::dirservd;
2  
3 ##
4 ## Copyright (c) 2003 Code Fusion cc
5 ##
6 ## Writen by Stuart Bingë <s.binge@codefusion.co.za>
7 ##
8 ## This program is free software; you can redistribute it and/or
9 ## modify it under the terms of the GNU General Public License as
10 ## published by the Free Software Foundation; either version 2, or
11 ## (at your option) any later version.
12 ##
13 ## This program is distributed in the hope that it will be useful,
14 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 ## General Public License for more details.
17 ##
18 ## You can view the GNU General Public License, online, at the GNU
19 ## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
20 ##
21  
22 1 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 0 ▶use Kolab;
Subroutine BEGIN: called CC=1 SCAR=2.6
26 use Kolab::Util;
27 use Kolab::LDAP;
28 use Net::LDAP;
29 use Net::LDAP::Control;
30 use vars qw($ldap $cyrus);
31  
32 require Exporter;
33  
34 our @ISA = qw(Exporter);
35  
36 our %EXPORT_TAGS = (
37 'all' => [ qw(
38 &startup
39 &run
40 ) ]
41 );
42  
43 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
44  
45 our @EXPORT = qw(
46  
47 );
48  
49 our $VERSION = sprintf('%d.%02d', q$Revision: 1.1.1.1 $ =~ /(\d+)\.(\d+)/);
50  
51 sub startup { 1; }
52  
53 sub shutdown
54 {
55 Kolab::log('DSd', 'Shutting down');
56 exit(0);
57 }
58  
59 sub abort
60 {
61 Kolab::log('DSd', 'Aborting');
62 exit(1);
63 }
64  
65 sub run
66 {
67 # This should be called from a separate thread, as we set our
68 # own interrupt handlers here
69  
70 $SIG{'INT'} = \&shutdown;
71 $SIG{'TERM'} = \&shutdown;
72  
73 END {
74 alarm 0;
75 }
76  
77 my $mesg;
78  
79 Kolab::log('DSd', 'Listener starting up, refresh is: '.$Kolab::config{'dirserv_poll_period'}." seconds");
80  
81 #while ($Kolab::config{'dirserv_mailbox_server'} ne '') {
82 while (1) {
83  
84 if ($Kolab::config{'dirserv_mailbox_user'} ne "") {
85 Kolab::log('DSd', 'Polling for DirServ updates', KOLAB_DEBUG);
86 Kolab::DirServ::handleNotifications(
87 $Kolab::config{'dirserv_mailbox_server'},
88 $Kolab::config{'dirserv_mailbox_user'},
89 $Kolab::config{'dirserv_mailbox_password'},
90 );
91 }
92  
93 sleep($Kolab::config{'dirserv_poll_period'});
94  
95  
96 };
97  
98  
99  
100 1;
101 }
102  
103 1;
104 __END__
↑ Summary