add the init_meta thing to ::Delta
[gitmo/Moose.git] / lib / Moose / Manual / MooseX.pod
index 607bf35..c47d15f 100644 (file)
@@ -1,8 +1,10 @@
-=pod
+package Moose::Manual::MooseX;
+
+# ABSTRACT: Recommended Moose extensions
 
-=head1 NAME
+__END__
 
-Moose::Manual::MooseX - Recommended Moose extensions
+=pod
 
 =head1 MooseX?
 
@@ -23,31 +25,21 @@ This document covers a few of the ones we like best.
 
 =head1 L<MooseX::AttributeHelpers>
 
-If you only look at one extension, it should be this one. It provides
-the equivalent of delegation for all of Perl's native data types, such
-as array reference, hash references, numbers, strings, etc.
+The functionality of this MooseX module has been moved into Moose core.
+See L<Moose::Meta::Attribute::Native>.
 
-This lets you create I<much> cleaner and fluent APIs.
+=head1 L<Moose::Autobox>
 
-  package User;
+MooseX::AttributeHelpers, but turned inside out, Moose::Autobox provides
+methods on both arrays/hashes/etc. but also references to them, using
+Moose roles, allowing you do to things like:
 
-  use Moose;
-  use MooseX::AttributeHelpers;
-
-  has '_orders' => (
-      metaclass => 'Collection::Array',
-      is        => 'ro',
-      isa       => 'ArrayRef',
-      default   => sub { [] },
-      provides  => {
-          push     => 'add_order',
-          shift    => 'next_order',
-          elements => 'orders',
-      },
-  );
+  use Moose::Autobox;
 
-Instead of directly exposing an array reference, we have three
-well-named, easy to use methods.
+  $somebody_elses_object->orders->push($order);
+
+Lexically scoped and not to everybody's taste, but very handy for sugaring
+up other people's APIs and your own code.
 
 =head1 L<MooseX::StrictConstructor>
 
@@ -72,7 +64,12 @@ silently ignored.
 =head1 L<MooseX::Params::Validate>
 
 We have high hopes for the future of L<MooseX::Method::Signatures> and
-L<MooseX::Declare>. However, for now we recommend the decidedly more
+L<MooseX::Declare>. However, these modules, while used regularly in
+production by some of the more insane members of the community, are
+still marked alpha just in case backwards incompatible changes need to
+be made.
+
+If you don't want to risk that, for now we recommend the decidedly more
 clunky (but also faster and simpler) L<MooseX::Params::Validate>. This
 module lets you apply Moose types and coercions to any method
 arguments.
@@ -80,7 +77,7 @@ arguments.
   package User;
 
   use Moose;
-  use MooseX::Params::Validate qw( validatep );
+  use MooseX::Params::Validate;
 
   sub login {
       my $self = shift;
@@ -130,9 +127,13 @@ From the command line, someone can execute the script:
 
 =head1 L<MooseX::Singleton>
 
-To be honest, using a singleton is often a hack, but it sure is a
-handy hack. L<MooseX::Singleton> lets you have a Moose class that's a
-singleton:
+To be honest, using a singleton is just a way to have a magic global
+variable in languages that don't actually have global variables.
+
+In perl, you can just as easily use a global. However, if your
+colleagues are Java-infected, they might prefer a singleton. Also, if
+you have an existing class that I<isn't> a singleton but should be,
+using L<MooseX::Singleton> is the easiest way to convert it.
 
   package Config;
 
@@ -166,13 +167,13 @@ cool, but still new and experimental.
 This extension helps you build a type library for your application. It
 also lets you predeclare type names and use them as barewords.
 
-  use MooseX::Types -declare => ['PosInt'];
+  use MooseX::Types -declare => ['PositiveInt'];
   use MooseX::Types::Moose 'Int';
 
-  subtype PositiveInt
-      => as Int,
-      => where { $_ > 0 }
-      => message {"Int is not larger than 0"};
+  subtype PositiveInt,
+      as Int,
+      where { $_ > 0 },
+      message { "Int is not larger than 0" };
 
 One nice feature is that those bareword names are actually namespaced
 in Moose's type registry, so multiple applications can use the same
@@ -211,6 +212,16 @@ attributes.
 
   class_has 'Cache' => ( ... );
 
+Note however that this class attribute does I<not> inherit like a
+L<Class::Data::Inheritable> or similar attribute - calling
+
+  $subclass->Cache($cache);
+
+will set it for the superclass as well. Additionally, class data is usually
+The Wrong Thing To Do in a strongly OO program since it makes testing a
+lot harder - consider carefully whether you'd be better off with an object
+that's passed around instead.
+
 =head2 L<MooseX::Daemonize>
 
 This is a role that provides a number of methods useful for creating a
@@ -221,7 +232,7 @@ file, and signal handling.
 
 If you find yourself wanting a role that customizes itself for each
 consumer, this is the tool for you. With this module, you can create a
-role that accepts parameters and generates attributes, methods, etc on
+role that accepts parameters and generates attributes, methods, etc. on
 a customized basis for each consumer.
 
 =head2 L<MooseX::POE>
@@ -240,17 +251,12 @@ Automatically names all accessors I<Perl Best Practices>-style,
 Automatically names all accessors with an explicit set and implicit
 get, "size" and "set_size".
 
-=head1 AUTHOR
-
-Dave Rolsky E<lt>autarch@urth.orgE<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2009 by Infinity Interactive, Inc.
-
-L<http://www.iinteractive.com>
+=head2 L<MooseX::NonMoose>
 
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
+MooseX::NonMoose allows for easily subclassing non-Moose classes with Moose,
+taking care of the annoying details connected with doing this, such as
+setting up proper inheritance from Moose::Object and installing
+(and inlining, at make_immutable time) a constructor that makes sure things
+like BUILD methods are called.
 
 =cut