NAME
YATT::Lite::MFields -- fields for multiple inheritance.
SYNOPSIS
#
# Like fields.pm
#
use YATT::Lite::MFields qw/foo bar baz/;
#
# Getter generation.
#
use YATT::Lite::MFields qw/^name cf_^age/;
#
# In above, ->name and ->value is defined.
# Or more descriptive (but most attributes are only for documentation)
use YATT::Lite::MFields
([name => (is => 'ro', doc => "Name of the user"
, getter => "get_name")]
, [age => (is => 'rw', doc => "Age of the user")]
);
# Or, more procedural way.
use YATT::Lite::MFields sub {
my ($meta) = @_;
$meta->has(name => is => 'ro', doc => "Name of the user");
$meta->has(age => is => 'rw', doc => "Age of the user");
};
DESCRIPTION
This module manipulates caller's %FIELDS
hash at compile time so that caller can detect field-name error at compile time. Traditionally this is done by fields module. But it explicitly prohibits multiple inheritance.
Yes, avoiding care-less use of multiple inheritance is important. But if used correctly, multi-inheritance is good tool to make your program being modular.