NAME Reindeer - Moose with more antlers VERSION version 0.005 SYNOPSIS # ta-da! use Reindeer; # ...is the same as: use Moose; use MooseX::MarkAsMethods autoclean => 1; use MooseX::AlwaysCoerce; use MooseX::AttributeShortcuts; # etc, etc, etc DESCRIPTION Like Moose? Use MooseX::* extensions? Maybe some MooseX::Types libraries? Hate that you have to use them in every. Single. Class. Reindeer aims to resolve that :) Reindeer _is_ Moose -- it's just Moose with a number of the more useful/popular extensions already applied. Reindeer is a drop-in replacement for your "use Moose" line, that behaves in the exact same way... Just with more pointy antlers. EARLY RELEASE! Be aware this package should be considered early release code. While Moose and all our incorporated extensions have their own classifications (generally GA or "stable"), this bundling is still under active development, and more extensions, features and the like may still be added. That said, my goal here is to increase functionality, not decrease it. When this package hits GA / stable, I'll set the release to be >= 1.000. NEW ATTRIBUTE OPTIONS Unless specified here, all options defined by Moose::Meta::Attribute and Class::MOP::Attribute remain unchanged. For the following, "$name" should be read as the attribute name; and the various prefixes should be read using the defaults coerce => 0 Coercion is ENABLED by default; explicitly pass "coerce => 0" to disable. (See also MooseX::AlwaysCoerce.) lazy_require => 1 The reader methods for all attributes with that option will throw an exception unless a value for the attributes was provided earlier by a constructor parameter or through a writer method. (See also MooseX::LazyRequire.) is => 'rwp' Specifing is => 'rwp' will cause the following options to be set: is => 'ro' writer => "_set_$name" is => 'lazy' Specifing is => 'lazy' will cause the following options to be set: is => 'ro' builder => "_build_$name" init_arg => undef lazy => 1 is => 'lazy', default => ... Specifing is => 'lazy' and a default will cause the following options to be set: is => 'ro' init_arg => undef lazy => 1 Note that this is the same as the prior option, but is included / phrased in this way in a (successful, I hope) attempt at clarity. builder => 1 Specifying builder => 1 will cause the following options to be set: builder => "_build_$name" clearer => 1 Specifying clearer => 1 will cause the following options to be set: clearer => "clear_$name" or, if your attribute name begins with an underscore: clearer => "_clear$name" (that is, an attribute named "_foo" would get "_clear_foo") predicate => 1 Specifying predicate => 1 will cause the following options to be set: predicate => "has_$name" or, if your attribute name begins with an underscore: predicate => "_has$name" (that is, an attribute named "_foo" would get "_has_foo") trigger => 1 Specifying trigger => 1 will cause the attribute to be created with a trigger that calls a named method in the class with the options passed to the trigger. By default, the method name the trigger calls is the name of the attribute prefixed with "_trigger_". e.g., for an attribute named "foo" this would be equivalent to: trigger => sub { shift->_trigger_foo(@_) } For an attribute named "_foo": trigger => sub { shift->_trigger__foo(@_) } This naming scheme, in which the trigger is always private, is the same as the builder naming scheme (just with a different prefix). doc => ... "doc" may now be used as a shorthand for "documentation". NEW KEYWORDS (SUGAR) In addition to all sugar provided by Moose (e.g. has, with, extends), we provide a couple new keywords. class_has => (...) Exactly like "has" in Moose, but operates at the class (rather than instance) level. (See also MooseX::ClassAttribute.) default_for default_for() is a shortcut to extend an attribute to give it a new default; this default value may be any legal value for default options. # attribute bar defined elsewhere (e.g. superclass) default_for bar => 'new default'; ... is the same as: has '+bar' => (default => 'new default'); abstract abstract() allows one to declare a method dependency that must be satisfied by a subclass before it is invoked, and before the subclass is made immutable. abstract 'method_name_that_must_be_satisfied'; requires requires() is a synonym for abstract() and works in the way you'd expect. AVAILABLE OPTIONAL ATTRIBUTE TRAITS We make available the following trait aliases. These traits are NOT automatically applied to attributes, and can be used as: has foo => (traits => [ AutoDestruct ], ...); AutoDestruct has foo => ( traits => [ AutoDestruct ], is => 'ro', lazy => 1, builder => 1, ttl => 600, ); Allows for a "ttl" attribute option; this is the length of time (in seconds) that a stored value is allowed to live; after that time the value is cleared and the value rebuilt (given that the attribute is lazy and has a builder defined). See MooseX::AutoDestruct for more information. MultiInitArg has 'data' => ( traits => [ MultiInitArg ], is => 'ro', isa => 'Str', init_args => [qw(munge frobnicate)], ); This trait allows your attribute to be initialized with any one of multiple arguments to new(). See MooseX::MultiInitArg for more information. UndefTolerant INCLUDED EXTENSIONS Reindeer includes the traits and sugar provided by the following extensions. Everything their docs say they can do, you can do by default with Reindeer. MooseX::AbstractMethod MooseX::AlwaysCoerce MooseX::AttributeShortcuts MooseX::ClassAttribute MooseX::LazyRequire MooseX::MarkAsMethods Note that this causes any overloads you've defined in your class/role to be marked as methods, and namespace::autoclean invoked. MooseX::NewDefaults MooseX::StrictConstructor INCLUDED TYPE LIBRARIES MooseX::Types::Moose MooseX::Types::Common::String MooseX::Types::Common::Numeric MooseX::Types::Path::Class MooseX::Types::Tied::Hash::IxHash OTHER Non-Moose specific items made available to your class/role: namespace::autoclean Technically, this is done by MooseX::MarkAsMethods, but it's worth pointing out here. Any overloads present in your class/role are marked as methods before autoclean is unleashed, so Everything Will Just Work as Expected. Path::Class Try::Tiny CAVEAT This author is applying his own assessment of "useful/popular extensions". You may find yourself in agreement, or violent disagreement with his choices. YMMV :) SEE ALSO Please see those modules/websites for more information related to this module. * Moose * All of the above referenced packages. SOURCE The development version is on github at and may be cloned from BUGS Please report any bugs or feature requests on the bugtracker website https://github.com/RsrchBoy/reindeer/issues When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. AUTHOR Chris Weyl COPYRIGHT AND LICENSE This software is Copyright (c) 2011 by Chris Weyl. This is free software, licensed under: The GNU Lesser General Public License, Version 2.1, February 1999