summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-11-18 16:41:27 +0000
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-11-18 16:41:27 +0000
commita0231f0e83307f241a212cdcb7ecea46e3dbf08c (patch)
tree2b7a0ec62f30e08417b5651f253d7c42e4b399e2 /lib
parent3e72f5af0c78f5895c39dc48ea0378e4cba19b2c (diff)
downloadperl-a0231f0e83307f241a212cdcb7ecea46e3dbf08c.tar.gz
magic_setisa enhanced to update %FIELDS automatically when @ISA
is assigned to. Added tests to t/op/array.t. magic_setisa now warns about including non-existent packages in @ISA when -w is on. p4raw-id: //depot/perl@264
Diffstat (limited to 'lib')
-rw-r--r--lib/Class/Fields.pm33
-rw-r--r--lib/ISA.pm20
2 files changed, 0 insertions, 53 deletions
diff --git a/lib/Class/Fields.pm b/lib/Class/Fields.pm
deleted file mode 100644
index 4b23e7d731..0000000000
--- a/lib/Class/Fields.pm
+++ /dev/null
@@ -1,33 +0,0 @@
-package Class::Fields;
-use Carp;
-
-sub import {
- my $class = shift;
- my ($package) = caller;
- my $fields = \%{"$package\::FIELDS"};
- my $i = $fields->{__MAX__};
- foreach my $f (@_) {
- if (defined($fields->{$f})) {
- croak "Field name $f already used by a base class"
- }
- $fields->{$f} = ++$i;
- }
- $fields->{__MAX__} = $i;
- push(@{"$package\::ISA"}, "Class::Fields");
-}
-
-sub new {
- my $class = shift;
- bless [\%{"$class\::FIELDS"}, @_], $class;
-}
-
-sub ISA {
- my ($class, $package) = @_;
- my $from_fields = \%{"$class\::FIELDS"};
- my $to_fields = \%{"$package\::FIELDS"};
- return unless defined %$from_fields;
- croak "Ambiguous inheritance for %FIELDS" if defined %$to_fields;
- %$to_fields = %$from_fields;
-}
-
-1;
diff --git a/lib/ISA.pm b/lib/ISA.pm
deleted file mode 100644
index d18242c13a..0000000000
--- a/lib/ISA.pm
+++ /dev/null
@@ -1,20 +0,0 @@
-package ISA;
-use Carp;
-
-sub import {
- my $class = shift;
- my ($package) = caller;
- foreach my $base (@_) {
- croak qq(No such class "$base") unless defined %{"$base\::"};
- eval {
- $base->ISA($package);
- };
- if ($@ && $@ !~ /^Can't locate object method/) {
- $@ =~ s/ at .*? line \d+\n$//;
- croak $@;
- }
- }
- push(@{"$package\::ISA"}, @_);
-}
-
-1;