fixing bug
[gitmo/Moose.git] / lib / Moose / Cookbook / Style.pod
index 4a28aaa..9530472 100644 (file)
@@ -2,7 +2,7 @@
 
 =head1 NAME
 
-Moose::Cookbook::Style - How to cook Moose with style
+Moose::Cookbook::Style - The latest in trendy Moose cuisine
 
 =for authors
 
@@ -125,15 +125,19 @@ Instead, prefix type name with your project namespace, or class name:
 
 Or with L<MooseX::Types>:
 
+    use MooseX::Types::Moose qw(Object);
+
     use MooseX::Types (
         -declare => [qw(Person)],
     );
     
     subtype Person() => ( # note parenthesis, "Person" is a function, not a string
-        as 'Object',
+        as Object, # MooseX::Types::Moose exported it
         where { $_->can("name") },
     );
 
+=head3 Coerce in a subtype
+
 Likewise use fully qualified subtypes of other types for defining coercions, so
 that they won't affect unrelated code, causing action at a distance.
 
@@ -157,4 +161,42 @@ Will add a coercion to B<all> attributes like:
 
 in a specific way.
 
+=head1 Clean up your package
+
+Use C<namespace::clean> or C<no Moose> to remove the sugar exports.
+
+This will make sure the sugar isn't accidentally called as methods on your objects.
+
+For instance:
+
+    $obj->can("has");
+
+will return true, even though C<has> is not a method.
+
+=head1 Accept no substitutes
+
+By substitutes I mean hacks instead of "proper" solutions.
 
+When you have a tricky requirement, refrain from abusing Moose or MooseX:: or
+whatever it is you are using.
+
+Instead, drop by IRC and discuss it. Most of the time a crazy idea can either
+be simplified, or it will spawn a clean, reliable feature to whatever package
+you are using.
+
+This will improve your code and also share the benefit with others.
+
+=head1 AUTHOR
+
+Yuval (nothingmuch) Kogman
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2006-2008 by Infinity Interactive, Inc.
+
+L<http://www.iinteractive.com>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut