From: Shawn M Moore Date: Sat, 20 Oct 2007 23:17:05 +0000 (+0000) Subject: Little fixes X-Git-Tag: 0_27~21 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dbea36a196ad46989057717245bbe994dd8e773c;p=gitmo%2FMoose.git Little fixes --- diff --git a/lib/Moose/Cookbook/Recipe11.pod b/lib/Moose/Cookbook/Recipe11.pod index ed66f60..603dc39 100644 --- a/lib/Moose/Cookbook/Recipe11.pod +++ b/lib/Moose/Cookbook/Recipe11.pod @@ -181,17 +181,18 @@ it. ); Ah ha! Now we're using the metaclass. We're adding a new attribute, C, to -C. C lets you set the metaclass of the attribute. Ordinarily (as we've seen), the metaclass is C. +C. C lets you set the metaclass of the attribute. +Ordinarily (as we've seen), the metaclass is C. When C sees that you're using a new metaclass, it will take the metaclass's name, prepend C, and call the C function in that package. So here Moose calls -C. We -definited that function earlier, it just returns our "real" metaclass' 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. :) +C. We defined +that function in the beginning -- it just returns our "real" metaclass' +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. :) Finally, we see that C is setting our new meta-attribute, C