On 25 Sep 2003, at 19:04, Matthias Helmling wrote:
Hi,

here's the part of code ($VERSION = "0.9901") from
the Schema.pm Module which i just downloaded from
theoryx5.uwinnipeg.ca/CPAN/data/perl-ldap/.

---------- [snipp] ------------------------

  while (@oc) {
    my $oc = shift @oc;

$done{lc $oc}++ and next;

    my $elem = $self->objectclass( $oc ) or next;
    my $res  = $elem->{$must_or_may} or next;
    @res{ @$res } = ();         # Add in, getting uniqueness

That is a bug, it should be


  if (my $res = $elem->{$must_or_may}) {
    @res{ @$res } = ();         # Add in, getting uniqueness
  }

so that it does continue to follow the sup chain

Graham.

    my $sup = $elem->{sup} or next;
    push @oc, @$sup;
  }

  my %unique = map { ($_,$_) } $self->attribute(keys %res);
  values %unique;
}

---------- [snipp] ------------------------

The loop iterates over all the super objectClasses for an object
(at least thats what i suggest it's supposed to do).

If an objectClass does NOT contain eihter a must or may entry
the super class is simply ignored

my $res = $elem->{$must_or_may} or next;

while the must or may of the super class are taken into account
if they are already in the objectClass just inspected.

eg.

class A:
  must: a, b
  may:  c, d

class B:
  super of class A
  must:
  may: e, f

than may(B)  returns (c,d,e,f)
     must(B) returns ()

Cheers,

Matthias Helmling

--
Matthias Helmling System Administration
LION bioscience AG, Waldhofer Str. 98, D-69123 Heidelberg





Reply via email to