Rename Basics::Recipe5 to Basics::HTTP_SubtypesAndCoercion
[gitmo/Moose.git] / lib / Moose / Manual / FAQ.pod
index ec73df8..422b5c8 100644 (file)
@@ -15,11 +15,11 @@ __END__
 
 Yes! Many sites with household names are using Moose to build
 high-traffic services. Countless others are using Moose in production.
-See L<http://www.iinteractive.com/moose/about.html#organizations> for
+See L<http://moose.iinteractive.com/about.html#organizations> for
 a partial list.
 
 As of this writing, Moose is a dependency of several hundred CPAN
-modules. L<http://cpants.perl.org/dist/used_by/Moose>
+modules. L<https://metacpan.org/requires/module/Moose>
 
 =head3 Is Moose's API stable?
 
@@ -77,12 +77,11 @@ C<BUILDARGS> method. The default implementation accepts key/value
 pairs or a hash reference. You can override it to take positional
 args, or any other format
 
-To change the handling of individual parameters, there are
-I<coercions> (See the L<Moose::Cookbook::Basics::Recipe5> for a
-complete example and explanation of coercions). With coercions it is
-possible to morph argument values into the correct expected
-types. This approach is the most flexible and robust, but does have a
-slightly higher learning curve.
+To change the handling of individual parameters, there are I<coercions> (See
+the L<Moose::Cookbook::Basics::HTTP_SubtypesAndCoercion> for a complete
+example and explanation of coercions). With coercions it is possible to morph
+argument values into the correct expected types. This approach is the most
+flexible and robust, but does have a slightly higher learning curve.
 
 =head3 How do I make non-Moose constructors work with Moose?
 
@@ -128,7 +127,7 @@ L<MooseX::SemiAffordanceAccessor>.
 
 NOTE: This B<cannot> be set globally in Moose, as that would break
 other classes which are built with Moose. You can still save on typing
-by defining a new L<MyApp::Moose> that exports Moose's sugar and then
+by defining a new C<MyApp::Moose> that exports Moose's sugar and then
 turns on L<MooseX::FollowPBP>. See
 L<Moose::Cookbook::Extending::Recipe4>.
 
@@ -156,7 +155,7 @@ coerce the value into a C<DateTime> object using the code in found
 in the C<via> block.
 
 For a more comprehensive example of using coercions, see the
-L<Moose::Cookbook::Basics::Recipe5>.
+L<Moose::Cookbook::Basics::HTTP_SubtypesAndCoercion>.
 
 If you need to deflate your attribute's value, the current best
 practice is to add an C<around> modifier to your accessor:
@@ -308,8 +307,9 @@ As for alternate solutions, there are a couple.
 =item *
 
 Using a combination of lazy and default in your attributes to defer
-initialization (see the Binary Tree example in the cookbook for a good
-example of lazy/default usage L<Moose::Cookbook::Basics::Recipe3>)
+initialization (see the Binary Tree example in the cookbook for a good example
+of lazy/default usage
+L<Moose::Cookbook::Basics::BinaryTree_AttributeFeatures>)
 
 =item *
 
@@ -363,6 +363,26 @@ Outside the context of Moose, traits and roles generally mean exactly
 the same thing. The original paper called them traits, but Perl 6
 will call them roles.
 
+=head3 Can an attribute-generated method (e.g. an accessor) satisfy requires?
+
+Yes, just be sure to consume the role I<after> declaring your
+attribute.  L<Moose::Manual::Roles/Required Attributes> provides
+an example:
+
+  package Breakable;
+  use Moose::Role;
+  requires 'stress';
+
+  package Car;
+  use Moose;
+  has 'stress' => ( is  => 'rw', isa => 'Int' );
+  with 'Breakable';
+
+If you mistakenly consume the C<Breakable> role before declaring your
+C<stress> attribute, you would see an error like this:
+
+  'Breakable' requires the method 'stress' to be implemented by 'Car' at...
+
 =head2 Moose and Subroutine Attributes
 
 =head3 Why don't subroutine attributes I inherited from a superclass work?