From: Stevan Little Date: Mon, 17 Mar 2008 01:18:09 +0000 (+0000) Subject: doc updates X-Git-Tag: 0_55~269 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=004222dc591495492d18979bee465a5a4fcbd8d5;p=gitmo%2FMoose.git doc updates --- diff --git a/Changes b/Changes index a04f042..cbd3a1c 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ Revision history for Perl extension Moose 0.41 + ~~ numerous documentation updates ~~ + ** IMPORTANT NOTE ** - the make_immutable keyword is now deprecated, don't use it in any new code and please fix your old code diff --git a/lib/Moose.pm b/lib/Moose.pm index 3ec025a..30fcf2e 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -381,11 +381,10 @@ L) this includes properly initializing all instance slots, setting defaults where appropriate, and performing any type constraint checking or coercion. -=head1 EXPORTED FUNCTIONS +=head1 PROVIDED METHODS -Moose will export a number of functions into the class's namespace which -may then be used to set up the class. These functions all work directly -on the current class. +Moose provides a number of methods to all your classes, mostly through the +inheritance of L. There is however, one exception. =over 4 @@ -393,6 +392,16 @@ on the current class. This is a method which provides access to the current class's metaclass. +=back + +=head1 EXPORTED FUNCTIONS + +Moose will export a number of functions into the class's namespace which +may then be used to set up the class. These functions all work directly +on the current class. + +=over 4 + =item B This function will set the superclass(es) for the current class. @@ -404,8 +413,7 @@ superclasses still properly inherit from L. =item B -This will apply a given set of C<@roles> to the local class. Role support -is currently under heavy development; see L for more details. +This will apply a given set of C<@roles> to the local class. =item B %options> @@ -424,7 +432,8 @@ accessor respectively, using the same name as the C<$name> of the attribute. If you need more control over how your accessors are named, you can use the I, I and I options inherited from -L. +L, however if you use those, you won't need the I +option. =item I $type_name> @@ -469,22 +478,6 @@ If an attribute is marked as lazy it B have a default supplied. This tells the accessor whether to automatically dereference the value returned. This is only legal if your C option is either C or C. -=item I $metaclass_name> - -This tells the class to use a custom attribute metaclass for this particular -attribute. Custom attribute metaclasses are useful for extending the -capabilities of the I keyword: they are the simplest way to extend the MOP, -but they are still a fairly advanced topic and too much to cover here. I will -try and write a recipe on them soon. - -The default behavior here is to just load C<$metaclass_name>; however, we also -have a way to alias to a shorter name. This will first look to see if -B exists. If it does, Moose -will then check to see if that has the method C, which -should return the actual name of the custom attribute metaclass. If there is no -C method, it will fall back to using -B as the metaclass name. - =item I $code> The I option is a CODE reference which will be called after the value of @@ -499,10 +492,6 @@ The I option provides Moose classes with automated delegation features. This is a pretty complex and powerful option. It accepts many different option formats, each with its own benefits and drawbacks. -B This feature is no longer experimental, but it may still have subtle -bugs lurking in the deeper corners. If you think you have found a bug, you -probably have, so please report it to me right away. - B The class being delegated to does not need to be a Moose based class, which is why this feature is especially useful when wrapping non-Moose classes. @@ -602,6 +591,37 @@ a HASH ref) of the methods you want mapped. =back +=item I $metaclass_name> + +This tells the class to use a custom attribute metaclass for this particular +attribute. Custom attribute metaclasses are useful for extending the +capabilities of the I keyword: they are the simplest way to extend the MOP, +but they are still a fairly advanced topic and too much to cover here, see +L for more information. + +The default behavior here is to just load C<$metaclass_name>; however, we also +have a way to alias to a shorter name. This will first look to see if +B exists. If it does, Moose +will then check to see if that has the method C, which +should return the actual name of the custom attribute metaclass. If there is no +C method, it will fall back to using +B as the metaclass name. + +=item I [ @role_names ]> + +This tells Moose to take the list of C<@role_names> and apply them to the +attribute meta-object. This is very similar to the I option, but +allows you to use more than one extension at a time. This too is an advanced +topic, we don't yet have a cookbook for it though. + +As with I, the default behavior is to just load C<$role_name>; however, +we also have a way to alias to a shorter name. This will first look to see if +B exists. If it does, Moose +will then check to see if that has the method C, which +should return the actual name of the custom attribute trait. If there is no +C method, it will fall back to using +B as the trait name. + =back =item B %options> @@ -724,18 +744,18 @@ method call and the C pseudo-package; it is really your choice. The keyword C, much like C, is a no-op outside of the context of an C method. You can think of C as being the inverse of C; the details of how C and C work is best described in -the L. +the L. =item B An C method, is a way of explicitly saying "I am augmenting this method from my superclass". Once again, the details of how C and -C work is best described in the L. +C work is best described in the L. =item B This is the C function, and exported here because I use it -all the time. This feature may change in the future, so you have been warned. +all the time. =item B @@ -825,6 +845,13 @@ two features separate (yet interoperable) actually makes them easy to use, since their behavior is then easier to predict. Time will tell whether I am right or not (UPDATE: so far so good). +=item * + +It is important to note that we currently have no simple way of combining +multiple extended versions of Moose (see L above), +and that in many cases they will conflict with one another. We are working on +developing a way around this issue, but in the meantime, you have been warned. + =back =head1 ACKNOWLEDGEMENTS @@ -870,6 +897,17 @@ technologies. =back +=head2 Books + +=over 4 + +=item The Art of the MetaObject Protocol + +I mention this in the L docs too, this book was critical in +the development of both modules and is highly recommended. + +=back + =head2 Papers =over 4 diff --git a/lib/Moose/Cookbook/FAQ.pod b/lib/Moose/Cookbook/FAQ.pod index ead3438..9f1092c 100644 --- a/lib/Moose/Cookbook/FAQ.pod +++ b/lib/Moose/Cookbook/FAQ.pod @@ -11,11 +11,11 @@ Moose::Cookbook::FAQ - Frequently asked questions about Moose =head3 Is Moose "production ready"? -Yes. I have three medium-to-large-ish web applications in +Yes. I have several medium-to-large-ish web applications in production using Moose, they have been running without -issue now for almost a year. +issue now for well over a year. -At $work we are re-writing our core offering to use Moose, +At C<$work> we are re-writing our core offering to use Moose, so it's continued development is assured. Several other people on #moose either have apps in production @@ -44,7 +44,7 @@ is mostly compile time. At this point we do have some options available for getting the speed you need. Currently we have the option of making your classes immutable -as a means of boosting speed. This will mean a larger compile +as a means of boosting speed. This will mean a slightly larger compile time cost, but the runtime speed increase (especially in object construction) is pretty significant. This is not very well documented yet, so please ask on the list or on #moose for more @@ -57,10 +57,7 @@ conversion to XS. =head3 When will Moose 1.0 be ready? -It is right now, I just haven't bumped the version number up yet. - -I still have some more internal TODO items I would like to complete -before I would even consider bumping it to 1.0. +It is right now, I declared 0.18 to be "ready to use". =head2 Constructors diff --git a/lib/Moose/Cookbook/Recipe7.pod b/lib/Moose/Cookbook/Recipe7.pod index 49a0932..c54d39a 100644 --- a/lib/Moose/Cookbook/Recipe7.pod +++ b/lib/Moose/Cookbook/Recipe7.pod @@ -55,6 +55,8 @@ Moose::Cookbook::Recipe7 - The augment/inner example sub create_tps_report { (shift)->append_body('') } + + print TPSReport->new->create #