From: Gerda Shank Date: Wed, 18 Nov 2009 21:33:32 +0000 (-0500) Subject: update BestPractices to emphasize namespace::autoclean. add link to X-Git-Tag: 0.93~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1af5d116f40ff0ea07e0d56f1a7f4a82c3ce82f6;p=gitmo%2FMoose.git update BestPractices to emphasize namespace::autoclean. add link to Native::Trait --- diff --git a/lib/Moose/Manual/BestPractices.pod b/lib/Moose/Manual/BestPractices.pod index c11eda0..f0edc9b 100644 --- a/lib/Moose/Manual/BestPractices.pod +++ b/lib/Moose/Manual/BestPractices.pod @@ -13,35 +13,34 @@ and using them consistently makes everyone's life easier. Of course, as with any list of "best practices", these are really just opinions. Feel free to ignore us. -=head2 C and immutabilize +=head2 C and immutabilize -We recommend that you end your Moose class definitions by removing the -Moose sugar and making your class immutable. +We recommend that you remove the Moose sugar and end your Moose class +definitions by making your class immutable. package Person; use Moose; + use namespace::autoclean; # extends, roles, attributes, etc. # methods - no Moose; - __PACKAGE__->meta->make_immutable; 1; -The C bit is simply good code hygiene, as it removes all the -Moose keywords from your class's namespace. Once the class has been +The C bit is simply good code hygiene, as it removes +imported symbols from you class's namespace at the end of your package's +compile cycle, including Moose keywords. Once the class has been built, these keywords are not needed needed. The C call allows Moose to speed up a lot of things, most notably object construction. The trade-off is that you can no longer change the class definition. -A more generic way to unimport not only L's exports but also -those from type libraries and other modules is to use -L or L. +C may be used to unimport only Moose's imported symbols. +L provides finer-grained control than L. =head2 Never override C diff --git a/lib/Moose/Meta/Attribute/Native/Trait.pm b/lib/Moose/Meta/Attribute/Native/Trait.pm index 3352a13..3aaa3db 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait.pm @@ -146,6 +146,10 @@ All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT. +=head1 SEE ALSO + +Documentation for Moose native traits starts at L + =head1 AUTHORS Yuval Kogman