NaturalDocs::DefineMembers

A custom Perl pragma to define member constants and accessors for use in Natural Docs objects while supporting inheritance.

Each member will be defined as a numeric constant which should be used as that variable’s index into the object arrayref.  They will be assigned sequentially from zero, and take into account any members defined this way in parent classes.  Note that you can not use multiple inheritance with this method.

If a parameter ends in parenthesis, it will be generated as an accessor for the previous member.  If it also starts with “Set”, the accessor will accept a single parameter to replace the value with.  If it’s followed with “duparrayref”, it will assume the parameter is either an arrayref or undef, and if the former, will duplicate it to set the value.

Example

package MyPackage;

use NaturalDocs::DefineMembers 'VAR_A', 'VarA()', 'SetVarA()',
                               'VAR_B', 'VarB()',
                               'VAR_C',
                               'VAR_D', 'VarD()', 'SetVarD() duparrayref';

sub SetC #(C)
   {
   my ($self, $c) = @_;
   $self->[VAR_C] = $c;
   };
Summary
NaturalDocs::DefineMembersA custom Perl pragma to define member constants and accessors for use in Natural Docs objects while supporting inheritance.
Functions
import

Functions

import

sub import #(member,
member,
...)
sub import #(member,
member,
...)
Close