KOBAYASHI, Hiroaki > YATT-Lite-0.0.7 > YATT::Lite::MFields

Download:
YATT-Lite-0.0.7.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  2
View/Report Bugs
Source   Latest Release: YATT-Lite-0.0.9

NAME ^

YATT::Lite::MFields -- fields for multiple inheritance.

SYNOPSIS ^

  # Like fields.pm
  use YATT::Lite::MFields qw/foo bar baz/;

  # Or more descriptive (but these attributes are for documentation only)
  use YATT::Lite::MFields
    ([name => is => 'ro', doc => "Name of the user"]
    , [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.

syntax highlighting: