Next Tricks of the Wizards 113

NEXT.pm

        sub class_structure {
          my $start = shift;
          my $prev;
          my @todo = ($start);
          my %next;
          while (@todo) {
            my $cur = shift @todo;
            $next{$prev} = $cur if defined $prev;
            unshift @todo, @{"$cur\::ISA"};
            $prev = $cur;
          }
          \%next;
        }

        { D => B,  B => A,  A => C,  C => undef }
        { B => A, A => undef }


Next Copyright © 2003 M. J. Dominus