fixing the trigger/constructor bug
[gitmo/Moose.git] / lib / Moose / Cookbook / Recipe9.pod
index adcba0c..c58bd3f 100644 (file)
@@ -89,7 +89,7 @@ the method to pass additional options to the constructor.
 Good object-oriented code should allow itself to be subclassed
 gracefully. Let's tweak C<_build_child_tree>:
 
-  sub _build_child_tree
+  sub _build_child_tree {
       my $self = shift;
 
       return (ref $self)->new( parent => $self, @_ );
@@ -127,8 +127,6 @@ of the role provide a builder method it.
       return Cat->new();
   }
 
-This simply could not be done using a C<default>.
-
 =head2 The lazy_build shortcut
 
 The C<lazy_build> attribute parameter can be used as sugar to specify
@@ -158,6 +156,11 @@ both start with an underscore. The C<builder> method I<always> starts
 with an underscore, since you will want this to be private the vast
 majority of the time.
 
+Note that the C<builder> method name is created by simply taking
+"_build_" and appending the attribute name. This means that attributes
+with a leading underscore like C<_animal> end up with a builder named
+C<_build__animal>.
+
 =head1 CONCLUSION
 
 The C<builder> option is a more OO-friendly version of the C<default>