YATT::Lite::MFields -- fields for multiple inheritance.
# # 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"); };
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.
%FIELDS
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.
To install YATT::Lite, copy and paste the appropriate command in to your terminal.
cpanm
cpanm YATT::Lite
CPAN shell
perl -MCPAN -e shell install YATT::Lite
For more information on module installation, please visit the detailed CPAN module installation guide.