From: Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 Date: Mon, 22 Jun 2009 13:30:08 +0000 (+0200) Subject: mention MooseX::NonMoose in extensions manual X-Git-Tag: 0.83~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cc7dafef836f7f5a462614fae917380a48f49062;p=gitmo%2FMoose.git mention MooseX::NonMoose in extensions manual * patch written by billb on IRC --- diff --git a/lib/Moose/Manual/FAQ.pod b/lib/Moose/Manual/FAQ.pod index a8dd307..442e6d1 100644 --- a/lib/Moose/Manual/FAQ.pod +++ b/lib/Moose/Manual/FAQ.pod @@ -98,8 +98,8 @@ coercions, and C, so subclassing is often not the ideal route. That said, if you really need to inherit from a non-Moose class, see -L for an example of how to do it, -or take a look at L on CPAN. +L for an example of how to do it, +or take a look at L. =head2 Accessors @@ -287,7 +287,7 @@ Moose 0.76 fixed a case where Coercions were being applied even if the original subtype Address => as 'Str'; coerce Address => from Str => via { get_address($_) }; - + Which is not what they intended. The Type Constraint C
is too loose in this case, it is saying that all Strings are Addresses, which is obviously not the case. The solution is to provide a where clause that properly restricts the Type Constraint. subtype Address => as Str => where { looks_like_address($_) }; diff --git a/lib/Moose/Manual/MooseX.pod b/lib/Moose/Manual/MooseX.pod index 1991a21..8327e13 100644 --- a/lib/Moose/Manual/MooseX.pod +++ b/lib/Moose/Manual/MooseX.pod @@ -272,6 +272,14 @@ Automatically names all accessors I-style, Automatically names all accessors with an explicit set and implicit get, "size" and "set_size". +=head2 L + +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. + =head1 AUTHOR Dave Rolsky Eautarch@urth.orgE