Base class for all traits
This class needs to be inherited by all traits so they can be identified as traits.
use Class::Trait 'base';
Not much going on here, just an \s-1AUTOLOAD\s0 method to help properly dispatch calls to \*(C`SUPER::\*(C' and an \*(C`apply\*(C' method.
require TSomeTrait; TSomeTrait->apply($object);
This method allows you to apply a trait to an object. It returns the trait so you can then reapply it:
TTricks->apply($dog_object) ->apply($cat_object);
This is merely syntactic sugar for the \*(C`Class::Trait::apply\*(C' method:
Class::Trait->apply($dog_object, 'TTricks'); Class::Trait->apply($cat_object, 'TTricks');
Class::Trait, Class::Trait::Config
Curtis \*(L"Ovid\*(R" Poe, \*(C`<ovid [at] cpan [dot] org>\*(C'
Stevan Little <[email protected]>
Copyright 2004, 2005 by Infinity Interactive, Inc.
<http://www.iinteractive.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.