Class::Trait 0.21 review
Download
|
|
Class::Trait is a Perl implementation of Traits in Perl.
SYNOPSIS
# to turn on debugging (do this before
# any other traits are loaded)
use Class::Trait 'debug';
# nothing happens, but the module is loaded
use Class::Trait;
# loads these two traits and flatten them
# into the current package
use Class::Trait qw(TPrintable TComparable);
# loading a trait and performing some
# trait operations (alias, exclude) first
use Class::Trait (
'TPrintable' => {
alias => { "stringValue" => "strVal" },
exclude => "stringValue",
},
);
# loading two traits and performing
# a trait operation (exclude) on one
# module to avoid method conflicts
use Class::Trait
'TComparable' => {
# exclude the basic equality method
# from TComparable and use the ones
# in TEquality instead.
exclude => [ "notEqualTo", "equalTo" ]
},
'TEquality' #
Class::Trait 0.21 search tags