-package SampleLDAP;
-use strict;
-use warnings;
-use POSIX;
-
# This is a sample Perl module for the OpenLDAP server slapd.
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
-## Copyright 1998-2007 The OpenLDAP Foundation.
+## Copyright 1998-2012 The OpenLDAP Foundation.
## Portions Copyright 1999 John C. Quillan.
## All rights reserved.
##
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.
-#
+
# Usage: Add something like this to slapd.conf:
#
# database perl
# perlModule SampleLDAP
#
# See the slapd-perl(5) manual page for details.
+#
+# This demo module keeps an in-memory hash {"DN" => "LDIF entry", ...}
+# built in sub add{} & co. The data is lost when slapd shuts down.
+
+package SampleLDAP;
+use strict;
+use warnings;
+use POSIX;
-our $VERSION = '1.00';
+$SampleLDAP::VERSION = '1.01';
sub new {
my $class = shift;
my $this = {};
bless $this, $class;
- print <STDERR>, "Here in new\n";
- print <STDERR>, 'Posix Var ' . BUFSIZ . ' and ' . FILENAME_MAX . "\n";
+ print {*STDERR} "Here in new\n";
+ print {*STDERR} 'Posix Var ' . BUFSIZ . ' and ' . FILENAME_MAX . "\n";
return $this;
}
my ( $base, $scope, $deref, $sizeLim, $timeLim, $filterStr, $attrOnly,
@attrs )
= @_;
- print <STDERR>, "====$filterStr====\n";
+ print {*STDERR} "====$filterStr====\n";
$filterStr =~ s/\(|\)//gm;
$filterStr =~ s/=/: /m;
my ($dn) = @_;
- print <STDERR>, "XXXXXX $dn XXXXXXX\n";
+ print {*STDERR} "XXXXXX $dn XXXXXXX\n";
delete $this->{$dn};
return 0;
}
my (@args) = @_;
local $, = ' - ';
- print <STDERR>, @args;
- print <STDERR>, "\n";
+ print {*STDERR} @args;
+ print {*STDERR} "\n";
return 0;
}