--- nfo/perl/libs/Class/Tangram.pm 2002/10/17 02:34:45 1.3 +++ nfo/perl/libs/Class/Tangram.pm 2002/11/09 01:06:30 1.4 @@ -119,7 +119,7 @@ available as C<$object-Efunction> on created objects. By virtue of inheritance, various other methods are available. -From Class::Tangram 1.12 onwards, no use of perl's C +From Class::Tangram 1.13 onwards, no use of perl's C functionality is used. =cut @@ -162,6 +162,9 @@ # if a class is abstract, complain if one is constructed. my (%abstract); +# records the inheritances of classes. +my (%bases); + =head1 METHODS The following methods are available for all Class::Tangram objects @@ -1075,7 +1078,7 @@ if ( my @stack = @{"${class}::ISA"}) { # clean "bases" information from @ISA my %seen = map { $_ => 1 } $class, __PACKAGE__; - $bases = []; + #$bases = []; # will anything break without this? it's needed for recording inheritances later on while ( my $super = pop @stack ) { if ( defined ${"${super}::schema"} or defined ${"${super}::fields"} ) { @@ -1105,6 +1108,9 @@ (ref $bases eq "ARRAY") or die "bases not an array ref for $class"; + # record bases of current class for later retrieval via Run-time type information + $bases{$class} = $bases; + # Note that the order of your bases is significant, that # is if you are using multiple iheritance then the later # classes override the earlier ones. @@ -1478,6 +1484,17 @@ exists $cleaners{$class} or import_schema($class); } +=item Class::Tangram::class_bases($class) + +Returns an array ref of class names the given class inherits from. + +=cut + +sub class_bases($) { + my $class = shift; + return $bases{$class}; +} + =item Class->set_init_default(attribute => $value); Sets the default value on an attribute for newly created "Class" @@ -1549,7 +1566,7 @@ =head2 MODULE RELEASE -This is Class::Tangram version 1.12. +This is Class::Tangram version 1.13. =head1 BUGS/TODO