The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

mop::traits - collection of traits for the mop

DESCRIPTION

This package contains the core traits provided by the mop.

TRAITS

rw

When applied to an attribute this will generate a read/write accessor for that attribute.

It has no effect if it is applied to classes or methods.

ro

When applied to an attribute this will generate a read-only accessor for that attribute.

This will throw an exception if it is applied to classes or methods.

required

When applied to an attribute this will result in a requirement that a value for this attribute be supplied via the constructor at instance creation time.

This will throw an exception if the attribute already has a default value associated with it.

This will throw an exception if it is applied to classes or methods.

weak_ref

When applied to an attribute this will result in the weakening of any value stored there.

This will throw an exception if it is applied to classes or methods.

lazy

When applied to an attribute this will result in the deferred initialization of the default value of this attribute.

This will throw an exception if it is applied to classes or methods.

abstract

When applied to a class this will mark the class as being abstract. It is required to use this trait if your class has any required methods in it.

This will throw an exception if it is applied to attributes or methods.

overload($operator)

When applied to a method this will use Perl's built in operator overloading to associate this method with the specified $operator. For more information about what kind of overload behaviors are supported see the overload module documentation.

This will throw an exception if it is applied to classes or attributes.

extending_non_mop

When applied to a class, whose superclass is a non-MOP class, this will attempt to ensure that both the superclass's constructor is called as well as the necessary initialization of the MOP class. Note that this is a temporary measure until we can make this Just Work automatically.

This will throw an exception if it is applied to attributes or methods.

repr($ref_type)

When applied to a class this will use the specified $ref_type as the underlying instance type for all instances of the class. Currently supported reference types as SCALAR, ARRAY, HASH and GLOB, and must be passed as those literal string. If a CODE reference is passed, it will be directly used by the mop to generate new instances.

This will throw an exception if it is applied to attributes or methods.

SEE ALSO

Traits Manual

mop::traits::util

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>

Florian Ragwitz <rafl@debian.org>

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.