1N/A # Shut up a possible typo warning. 1N/A () = \%{$_[
0].
'::FIELDS'};
1N/A my $f = \%{$_[
0].
'::FIELDS'};
1N/A # should be centralized in fields? perhaps 1N/A # fields::mk_FIELDS_be_OK. Peh. As long as %{ $package . '::FIELDS' } 1N/A # is used here anyway, it doesn't matter. 1N/A bless $f,
'pseudohash' if (
ref($f)
ne 'pseudohash');
1N/A # Shut up a possible typo warning. 1N/A () = \%{$_[
0].
'::FIELDS'};
1N/A return \%{$_[
0].
'::FIELDS'};
1N/A # List of base classes from which we will inherit %FIELDS. 1N/A unless defined ${$
base.
'::VERSION'};
1N/A eval "require $base";
1N/A # Only ignore "Can't locate" errors from our eval require. 1N/A # Other fatal errors (syntax etc) must be reported. 1N/A die if $@ && $@ !~ /^
Can't locate .*? at \(eval /; 1N/A unless (%{
"$base\::"}) {
1N/A unless defined ${$
base.
'::VERSION'};
1N/A # No multiple fields inheritence *suck* 1N/A Carp::
croak(
"Can't multiply inherit %FIELDS");
1N/A warn "$derived is inheriting from $base but already has its own ".
1N/A "This will cause problems.\n".
1N/A "Be sure you use base BEFORE declaring fields\n";
1N/A # Iterate through the base's fields adding all the non-private 1N/A # ones to the derived class. Hang on to the original attribute 1N/A # (Public, Private, etc...) and add Inherited. 1N/A # This is all too complicated to do efficiently with add_fields(). 1N/A Carp::
croak (
"Inherited %FIELDS can't override existing %FIELDS");
1N/A foreach my $
idx (
1..$
#{$battr}) { 1N/Abase - Establish IS-A relationship with base classes at compile time 1N/A use base qw(Foo Bar); 1N/AAllows you to both load one or more modules, while setting up inheritance from 1N/Athose modules at the same time. Roughly similar in effect to 1N/A push @ISA, qw(Foo Bar); 1N/AIf any of the listed modules are not loaded yet, I<base> silently attempts to 1N/AC<require> them (and silently continues if the C<require> failed). Whether to 1N/AC<require> a base class module is determined by the absence of a global variable 1N/A$VERSION in the base package. If $VERSION is not detected even after loading 1N/Ait, <base> will define $VERSION in the base package, setting it to the string 1N/AWill also initialize the fields if one of the base classes has it. 1N/AMultiple inheritence of fields is B<NOT> supported, if two or more 1N/Abase classes each have inheritable fields the 'base' pragma will 1N/Acroak. See L<fields>, L<public> and L<protected> for a description of 1N/AThis module was introduced with Perl 5.004_04. 1N/ADue to the limitations of the implementation, you must use 1N/Abase I<before> you declare any of your own fields.