3 base - Establish IS-A relationship with base class at compile time
12 Roughly similar in effect to
17 push @ISA, qw(Foo Bar);
20 Will also initialize the %FIELDS hash if one of the base classes has
21 it. Multiple inheritance of %FIELDS is not supported. The 'base'
22 pragma will croak if multiple base classes has a %FIELDS hash. See
23 L<fields> for a description of this feature.
25 When strict 'vars' is in scope I<base> also let you assign to @ISA
26 without having to declare @ISA with the 'vars' pragma first.
28 This module was introduced with Perl 5.004_04.
42 foreach my $base (@_) {
43 unless (defined %{"$base\::"}) {
45 # Only ignore "Can't locate" errors from our eval require.
46 # Other fatal errors (syntax etc) must be reported.
47 die if $@ && $@ !~ /^Can't locate .*? at \(eval /;
48 unless (defined %{"$base\::"}) {
50 Carp::croak("Base class package \"$base\" is empty.\n",
51 "\t(Perhaps you need to 'use' the module ",
52 "which defines that package first.)");
56 # A simple test like (defined %{"$base\::FIELDS"}) will
57 # sometimes produce typo warnings because it would create
58 # the hash if it was not present before.
60 if ($fglob = ${"$base\::"}{"FIELDS"} and *$fglob{HASH}) {
63 Carp::croak("Can't multiply inherit %FIELDS");
70 push @{"$pkg\::ISA"}, @_;
73 fields::inherit($pkg, $fields_base);