/[virtual-ldap]/bin/ldap-koha.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /bin/ldap-koha.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 34 - (hide annotations)
Mon Mar 23 21:55:39 2009 UTC (15 years ago) by dpavlin
File MIME type: text/plain
File size: 745 byte(s)
listen on IP address and port

1 dpavlin 32 #!/usr/bin/perl
2    
3     use strict;
4     use warnings;
5    
6     use IO::Select;
7     use IO::Socket;
8     use lib 'lib';
9     use LDAP::Koha;
10    
11 dpavlin 34 my $listen = '10.60.0.13:2389';
12 dpavlin 32
13     my $sock = IO::Socket::INET->new(
14     Listen => 5,
15     Proto => 'tcp',
16     Reuse => 1,
17 dpavlin 34 LocalAddr => $listen,
18 dpavlin 32 ) || die;
19    
20 dpavlin 34 warn "# listening on $listen";
21 dpavlin 32
22     my $sel = IO::Select->new($sock);
23     my %Handlers;
24     while (my @ready = $sel->can_read) {
25     foreach my $fh (@ready) {
26     if ($fh == $sock) {
27     # let's create a new socket
28     my $psock = $sock->accept;
29     $sel->add($psock);
30     $Handlers{*$psock} = LDAP::Koha->new($psock);
31     } else {
32     my $result = $Handlers{*$fh}->handle;
33     if ($result) {
34     # we have finished with the socket
35     $sel->remove($fh);
36     $fh->close;
37     delete $Handlers{*$fh};
38     }
39     }
40     }
41     }
42    
43     1;

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26