Stevan Little > mop-0.02-TRIAL > mop::manual::details::traits

Download:
mop-0.02-TRIAL.tar.gz

Annotate this POD

Website

View/Report Bugs
Source   Latest Release: mop-0.03-TRIAL

NAME ^

mop::manual::details::traits - A manual for p5-mop

DESCRIPTION ^

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.

BUGS ^

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.

Git Repository

Issue Tracker

AUTHOR ^

Stevan Little <stevan.little@iinteractive.com>

Jesse Luehrs <doy@tozt.net>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2013 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.

syntax highlighting: