base - Establish IS-A relationship with base class at compile time |
base - Establish IS-A relationship with base class at compile time
package Baz; use base qw(Foo Bar);
Roughly similar in effect to
BEGIN { require Foo; require Bar; push @ISA, qw(Foo Bar); }
Will also initialize the %FIELDS hash if one of the base classes has it using all public and protected data members of the base classes. Multiple Inheritence of fields is NOT supported. If two or more base classes each have inheritable fields the 'base' pragma will croak. See fields, public and protected for a description of this feature.
Due to the limitations of the pseudo-hash implementation, you must use base before you declare any of your own fields.
When strict 'vars' is in scope base also lets you assign to @ISA without having to declare @ISA with the 'vars' pragma first.
If any of the base classes are not loaded yet, base silently
require
s them. Whether to require
a base class package is
determined by the absence of a global $VERSION in the base package.
If $VERSION is not detected even after loading it, <base> will
define $VERSION in the base package, setting it to the string
-1, defined by base.pm
.
This module was introduced with Perl 5.004_04.
This is the base.pm which was installed as part of the Class::Fields package. NOT the base.pm which is distributed with Perl. This version should safely emulate everything that 5.6.0's base.pm does. It passes all of 5.6.0's regression tests.
It should also work under 5.005_03, although if you're going to be screwing around with pseudohashes you really should upgrade to 5.6.0.
fields, public, protected, protected, the Class::Fields manpage
base - Establish IS-A relationship with base class at compile time |