119 |
available as C<$object-E<gt>function> on created objects. By virtue |
available as C<$object-E<gt>function> on created objects. By virtue |
120 |
of inheritance, various other methods are available. |
of inheritance, various other methods are available. |
121 |
|
|
122 |
From Class::Tangram 1.12 onwards, no use of perl's C<AUTOLOAD> |
From Class::Tangram 1.13 onwards, no use of perl's C<AUTOLOAD> |
123 |
functionality is used. |
functionality is used. |
124 |
|
|
125 |
=cut |
=cut |
162 |
# if a class is abstract, complain if one is constructed. |
# if a class is abstract, complain if one is constructed. |
163 |
my (%abstract); |
my (%abstract); |
164 |
|
|
165 |
|
# records the inheritances of classes. |
166 |
|
my (%bases); |
167 |
|
|
168 |
=head1 METHODS |
=head1 METHODS |
169 |
|
|
170 |
The following methods are available for all Class::Tangram objects |
The following methods are available for all Class::Tangram objects |
1078 |
if ( my @stack = @{"${class}::ISA"}) { |
if ( my @stack = @{"${class}::ISA"}) { |
1079 |
# clean "bases" information from @ISA |
# clean "bases" information from @ISA |
1080 |
my %seen = map { $_ => 1 } $class, __PACKAGE__; |
my %seen = map { $_ => 1 } $class, __PACKAGE__; |
1081 |
$bases = []; |
#$bases = []; # will anything break without this? it's needed for recording inheritances later on |
1082 |
while ( my $super = pop @stack ) { |
while ( my $super = pop @stack ) { |
1083 |
if ( defined ${"${super}::schema"} |
if ( defined ${"${super}::schema"} |
1084 |
or defined ${"${super}::fields"} ) { |
or defined ${"${super}::fields"} ) { |
1108 |
(ref $bases eq "ARRAY") |
(ref $bases eq "ARRAY") |
1109 |
or die "bases not an array ref for $class"; |
or die "bases not an array ref for $class"; |
1110 |
|
|
1111 |
|
# record bases of current class for later retrieval via Run-time type information |
1112 |
|
$bases{$class} = $bases; |
1113 |
|
|
1114 |
# Note that the order of your bases is significant, that |
# Note that the order of your bases is significant, that |
1115 |
# is if you are using multiple iheritance then the later |
# is if you are using multiple iheritance then the later |
1116 |
# classes override the earlier ones. |
# classes override the earlier ones. |
1484 |
exists $cleaners{$class} or import_schema($class); |
exists $cleaners{$class} or import_schema($class); |
1485 |
} |
} |
1486 |
|
|
1487 |
|
=item Class::Tangram::class_bases($class) |
1488 |
|
|
1489 |
|
Returns an array ref of class names the given class inherits from. |
1490 |
|
|
1491 |
|
=cut |
1492 |
|
|
1493 |
|
sub class_bases($) { |
1494 |
|
my $class = shift; |
1495 |
|
return $bases{$class}; |
1496 |
|
} |
1497 |
|
|
1498 |
=item Class->set_init_default(attribute => $value); |
=item Class->set_init_default(attribute => $value); |
1499 |
|
|
1500 |
Sets the default value on an attribute for newly created "Class" |
Sets the default value on an attribute for newly created "Class" |
1566 |
|
|
1567 |
=head2 MODULE RELEASE |
=head2 MODULE RELEASE |
1568 |
|
|
1569 |
This is Class::Tangram version 1.12. |
This is Class::Tangram version 1.13. |
1570 |
|
|
1571 |
=head1 BUGS/TODO |
=head1 BUGS/TODO |
1572 |
|
|