mop::manual::details::traits - A manual for p5-mop
Traits are the preferred method of extension for the mop. A trait is simply a subroutine which is in scope at the time of class creation. The subroutine accepts as it's first argument the meta-object it is being invoked upon, followed by any remaining arguments that are passed.
Here is a simplistic example:
class Foo is bar, baz(10, "gorch") {}
The MOP will transform this into the following:
class Foo {} mop::traits::util::apply_trait(\&bar, mop::meta('Foo')); mop::traits::util::apply_trait(\&baz, mop::meta('Foo'), 10, "gorch");
The same transformation will occur when traits are applied to attributes and methods.
Since this module is still under development we would prefer to not use the RT bug queue and instead use the built in issue tracker on Github.
Stevan Little <stevan.little@iinteractive.com>
Jesse Luehrs <doy@tozt.net>
This software is copyright (c) 2013-2014 by Infinity Interactive.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install mop, copy and paste the appropriate command in to your terminal.
cpanm
cpanm mop
CPAN shell
perl -MCPAN -e shell install mop
For more information on module installation, please visit the detailed CPAN module installation guide.