[Date Prev][Date Next] [Chronological] [Thread] [Top]

Understanding back_perl SampleLDAP.pm

Hi list,
could someone help me in understanding what the SampleLDAP.pm perl module do in its search routine?

This is the code:
sub search {
    my $this = shift;
    my ( $base, $scope, $deref, $sizeLim, $timeLim, $filterStr, $attrOnly,
        @attrs )
      = @_;
    print {*STDERR} "====$filterStr====\n";
    $filterStr =~ s/\(|\)//gm;
    $filterStr =~ s/=/: /m;

    my @match_dn = ();
    for my $dn ( keys %{$this} ) {
        if ( $this->{$dn} =~ /$filterStr/imx ) {
            push @match_dn, $dn;
            last if ( scalar @match_dn == $sizeLim );


    my @match_entries = ();

    for my $dn (@match_dn) {
        push @match_entries, $this->{$dn};

    return ( 0, @match_entries );


I'm interested in knowing what "keys %{$this}" should contain and why, in trying to use this sample perl module I cannot see any "key" of the array variable $this.

I configured the database in this way:

database        perl
suffix          "dc=perl,dc=com"
perlModulePath  /tmp/appoggio/
perlModule      SampleLDAP

Thanks in advance