RECENT POSTS

P5-moosex-traits

May 26, 2018

Moose eXtension to automatically apply roles at object creation time

Often you want to create components that can be added to a class arbitrarily. This module makes it easy for the end user to use these components. Instead of requiring the user to create a named class with the desired roles applied, or applying roles to the instance one-by-one, he can just pass a traits parameter to the class’s new_with_traits constructor. This role will then apply the roles in one go, cache the resulting class for efficiency, and return a new instance. Arguments meant to initialize the applied roles’ attributes can also be passed to the constructor.

WWW http//search.cpan.org/dist/MooseX-Traits/