X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FCookbook.pod;h=2b5992321585d3936237edaac668683237530eba;hb=174418c2f3ea3979f16f4f96edc35ee4d762e0c0;hp=d4a649f95f8a45eb9e163126835777e2fc6da922;hpb=1068dcb5ae2ecd32b9ef2d27cfd73959c0a3d244;p=gitmo%2FMoose.git diff --git a/lib/Moose/Cookbook.pod b/lib/Moose/Cookbook.pod index d4a649f..2b59923 100644 --- a/lib/Moose/Cookbook.pod +++ b/lib/Moose/Cookbook.pod @@ -1,9 +1,11 @@ +package Moose::Cookbook; -=pod +# ABSTRACT: How to cook a Moose + +__END__ -=head1 NAME -Moose::Cookbook - How to cook a Moose +=pod =head1 DESCRIPTION @@ -24,61 +26,61 @@ laziness, types, type coercion, method modifiers, and more. =over 4 -=item L - The (always classic) B example +=item L -A simple Moose-based class. Demonstrates Moose attributes and subclassing. +A simple Moose-based class. Demonstrates basic Moose attributes and subclassing. -=item L - A simple B example +=item L -A slightly more complex Moose class. Demonstrates using a method -modifier in a subclass. +A slightly more complex Moose class. Demonstrates using a method modifier in a +subclass. -=item L - A lazy B example +=item L Demonstrates several attribute features, including types, weak references, predicates ("does this object have a foo?"), defaults, laziness, and triggers. -=item L - Subtypes, and modeling a simple B class hierarchy - -Introduces the creation and use of custom types, a C method, -and the use of C in a subclass. +=item L -=item L - More subtypes, coercion in a B class +Introduces the creation and use of custom types, a C method, and the +use of C in a subclass. This recipe also shows how to model a set of +classes that could be used to model companies, people, employees, etc. -More type examples, including the use of type coercions. +=item L -=item L - The augment/inner example - -Demonstrates the use of C method modifiers, a way of turning -the usual method overriding style "inside-out". +This recipe covers more subtype creation, including the use of type coercions. =item L - Making Moose fast with immutable Making a class immutable greatly increases the speed of accessors and object construction. -=item L - Managing complex relations with trigger (TODO) - -I - -Work off of this http://code2.0beta.co.uk/moose/svn/Moose/trunk/t/200_examples/007_Child_Parent_attr_inherit.t - -=item L - Builder methods and lazy_build +=item L - Builder methods and lazy_build The builder feature provides an inheritable and role-composable way to provide a default attribute value. -=item L - Operator overloading, subtypes, and coercion +=item L - Operator overloading, subtypes, and coercion Demonstrates using operator overloading, coercion, and subtypes to model how eye color is determined during reproduction. -=item L - Using BUILDARGS and BUILD to hook into object construction +=item L - Using BUILDARGS and BUILD to hook into object construction This recipe demonstrates the use of C and C to hook into object construction. +=item L - Extending a non-Moose base class + +In this recipe, we make a Moose-based subclass of L, a +module which does not use Moose itself. + +=item L + +Demonstrates the use of C method modifiers, a way of turning +the usual method overriding style "inside-out". + =back =head2 Moose Roles @@ -118,13 +120,6 @@ you extend the object system provided by Moose. If you're wondering what all this "meta" stuff is, and why you should care about it, read this "recipe". -=item L - A meta-attribute, attributes with labels - -One way to extend Moose is to provide your own attribute -metaclasses. Attribute metaclasses let you extend attribute -declarations (with C) and behavior to provide additional -attribute functionality. - =item L - Labels implemented via attribute traits Extending Moose's attribute metaclass is a great way to add @@ -132,13 +127,6 @@ functionality. However, attributes can only have one metaclass. Applying roles to the attribute metaclass lets you provide composable attribute functionality. -=item L - Adding a "table" attribute to the metaclass - -If you want to store more information about your classes, you'll have -to extend C. Doing so is simple, but you'll -probably also want to provide some sugar, so see -L as well. - =item L - The "table" attribute implemented as a metaclass trait This recipe takes the class metaclass we saw in the previous recipe @@ -155,7 +143,7 @@ This recipe shows an example of how you create your own meta-instance class. The meta-instance determines the internal structure of object instances and provide access to attribute slots. -=item L - Hooking into immutabilization (TODO) +=item Moose::Cookbook::Meta::Recipe8 - Hooking into immutabilization (TODO) Moose has a feature known as "immutabilization". By calling C<< __PACKAGE__->meta()->make_immutable() >> after defining your class @@ -226,17 +214,4 @@ object class. =back -=head1 AUTHOR - -Stevan Little Estevan@iinteractive.comE - -=head1 COPYRIGHT AND LICENSE - -Copyright 2006-2009 by Infinity Interactive, Inc. - -L - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. - =cut