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

Diff of /lib/LDAP/Virtual.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

lib/VLDAP/Server.pm revision 3 by dpavlin, Sat Mar 14 14:44:45 2009 UTC lib/LDAP/Virtual.pm revision 6 by dpavlin, Sat Mar 14 18:21:29 2009 UTC
# Line 1  Line 1 
1  package VLDAP::Server;  package LDAP::Virtual;
2    
3  use strict;  use strict;
4  use warnings;  use warnings;
# Line 20  use URI::Escape;       # uri_escape Line 20  use URI::Escape;       # uri_escape
20  use IO::Socket::INET;  use IO::Socket::INET;
21  use IO::Select;  use IO::Select;
22    
23    use YAML qw/DumpFile/;
24    
25  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
26    
27  =head1 NAME  =head1 NAME
28    
29  VLDAP::Server  LDAP::Virtual
30    
31  =cut  =cut
32    
# Line 36  Provide LDAP server functionality somewh Line 38  Provide LDAP server functionality somewh
38    
39  =head2 run  =head2 run
40    
41    my $pid = VLDAP::Server->run({ port => 1389, fork => 0 });    my $pid = LDAP::Virtual->run({ port => 1389, fork => 0 });
42    
43  =cut  =cut
44    
# Line 44  our $pids; Line 46  our $pids;
46  our $cache;  our $cache;
47    
48  sub cache {  sub cache {
49          return $cache if $cache;          return $cache;
         $cache = new A3C::Cache->new({ instance => '', dir => 'ldap' });  
50  }  }
51    
52  sub run {  sub run {
# Line 82  sub run { Line 83  sub run {
83                                  # let's create a new socket                                  # let's create a new socket
84                                  my $psock = $sock->accept;                                  my $psock = $sock->accept;
85                                  $sel->add($psock);                                  $sel->add($psock);
86                                  $Handlers{*$psock} = VLDAP::Server->new($psock);                                  $Handlers{*$psock} = LDAP::Virtual->new($psock);
87                          } else {                          } else {
88                                  my $result = $Handlers{*$fh}->handle;                                  my $result = $Handlers{*$fh}->handle;
89                                  if ($result) {                                  if ($result) {
# Line 98  sub run { Line 99  sub run {
99    
100  =head2 stop  =head2 stop
101    
102    my $stopped_pids = VLDAP::Server->stop;    my $stopped_pids = LDAP::Virtual->stop;
103    
104  =cut  =cut
105    
# Line 241  sub search { Line 242  sub search {
242    
243          warn "## entries = ",dump( @entries );          warn "## entries = ",dump( @entries );
244    
245          $self->cache->write_cache( \@entries, uri_escape( $filter ));  #       $self->cache->write_cache( \@entries, uri_escape( $filter ));
246    
247            my $path = uri_escape( $filter );
248            DumpFile( "var/${path}.yml", \@entries );
249            warn "# created $path ", -s $path, " bytes";
250    
251          return RESULT_OK, @entries;          return RESULT_OK, @entries;
252  }  }

Legend:
Removed from v.3  
changed lines
  Added in v.6

  ViewVC Help
Powered by ViewVC 1.1.26