From: Shawn M Moore Date: Sun, 21 Oct 2007 07:19:01 +0000 (+0000) Subject: Many more fixes. That's probably all of them! X-Git-Tag: 0_27~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fe2d5aba0346f1c98cf9887c3c0d3ea057e440b2;p=gitmo%2FMoose.git Many more fixes. That's probably all of them! --- diff --git a/lib/Moose/Cookbook/Recipe11.pod b/lib/Moose/Cookbook/Recipe11.pod index ef67479..cb0aa35 100644 --- a/lib/Moose/Cookbook/Recipe11.pod +++ b/lib/Moose/Cookbook/Recipe11.pod @@ -149,15 +149,14 @@ fare. This is merely making a new attribute. An attribute that attributes have. A meta-attribute. It may sound scary, but it really isn't! Reread L if this really is terrifying. -The name is "label", it will have a regular accessor (except of course at -create time), and is a tring. C is a standard part of C. It -just creates a method that asks the question "Does this attribute have a -value?" +The name is "label", it will have a regular accessor, and is a string. +C is a standard part of C. It just creates a method that asks +the question "Does this attribute have a value?" package Moose::Meta::Attribute::Custom::Labeled; sub register_implementation { 'MyApp::Meta::Attribute::Labeled' } -This registers our new metaclass with Moose. That way attributes can actually +This lets Moose discover our new metaclass. That way attributes can actually use it. More on what this is doing in a moment. Note that we're done defining the new metaclass! Only nine lines of code, and @@ -190,20 +189,23 @@ package, C. So Moose uses that metaclass for the attribute. It may seem a bit convoluted, but the alternative would be to use C<< metaclass => 'MyApp::Meta::Attribute::Labeled' >> on every attribute. As usual, Moose optimizes in favor of the end user, not the metaprogrammer. :) +We also could have just defined the metaclass in +C, but it's probably better to keep to +your own namespaces. Finally, we see that C is setting our new meta-attribute, C