Revision history for Perl extension Moose
0.04
+ * Moose::Cookbook
+ - added new Role recipe
+
+ * Moose
+ - added 'with' keyword for Role support
+ - added test and docs for this
+ - fixed subtype quoting bug
+ - added test for this
+
+ * Moose::Role
+ - Roles for Moose
+ - added test and docs
+
+ * Moose::Meta::Role
+ - the meta role to support Moose::Role
+ - added tests and docs
+
+ * Moose::Meta::Class
+ - moved a number of things from Moose.pm
+ to here, they should have been here
+ in the first place
+
+ * Moose::Meta::Attribute
+ - moved the attribute option macros here
+ instead of putting them in Moose.pm
0.03 Thurs. March 30, 2006
* Moose::Cookbook
t/054_util_type_coercion.t
t/055_util_type_reloading.t
t/056_util_more_type_coercion.t
+t/100_subtype_quote_bug.t
t/pod.t
t/pod_coverage.t
t/lib/Bar.pm
# make a subtype for each Moose class
subtype $pkg
- => as Object
+ => as 'Object'
=> where { $_->isa($pkg) };
my $meta;
replace it. This is important to ensure that classes which do not have
superclasses properly inherit from L<Moose::Object>.
+=item B<with ($role)>
+
+This will apply a given C<$role> to the local class.
+
=item B<has ($name, %options)>
This will install an attribute of a given C<$name> into the current class.
This method makes sure to handle the moose weak-ref, type-constraint
and type coercion features.
+=item B<has_method ($name)>
+
+This accomidates Moose::Meta::Role::Method instances, which are
+aliased, instead of added, but still need to be counted as valid
+methods.
+
=item B<add_override_method_modifier ($name, $method)>
=item B<add_augment_method_modifier ($name, $method)>
# define some basic types
-type Any => where { 1 };
+type 'Any' => where { 1 };
-type Value => where { !ref($_) };
-type Ref => where { ref($_) };
+type 'Value' => where { !ref($_) };
+type 'Ref' => where { ref($_) };
-subtype Int => as Value => where { Scalar::Util::looks_like_number($_) };
-subtype Str => as Value => where { !Scalar::Util::looks_like_number($_) };
+subtype 'Int' => as 'Value' => where { Scalar::Util::looks_like_number($_) };
+subtype 'Str' => as 'Value' => where { !Scalar::Util::looks_like_number($_) };
-subtype ScalarRef => as Ref => where { ref($_) eq 'SCALAR' };
-subtype ArrayRef => as Ref => where { ref($_) eq 'ARRAY' };
-subtype HashRef => as Ref => where { ref($_) eq 'HASH' };
-subtype CodeRef => as Ref => where { ref($_) eq 'CODE' };
-subtype RegexpRef => as Ref => where { ref($_) eq 'Regexp' };
+subtype 'ScalarRef' => as 'Ref' => where { ref($_) eq 'SCALAR' };
+subtype 'ArrayRef' => as 'Ref' => where { ref($_) eq 'ARRAY' };
+subtype 'HashRef' => as 'Ref' => where { ref($_) eq 'HASH' };
+subtype 'CodeRef' => as 'Ref' => where { ref($_) eq 'CODE' };
+subtype 'RegexpRef' => as 'Ref' => where { ref($_) eq 'Regexp' };
# NOTE:
# blessed(qr/.../) returns true,.. how odd
-subtype Object => as Ref => where { blessed($_) && blessed($_) ne 'Regexp' };
+subtype 'Object' => as 'Ref' => where { blessed($_) && blessed($_) ne 'Regexp' };
1;
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+
+=pod
+
+This is a test for a bug found by Purge on #moose:
+The code:
+
+ subtype Stuff
+ => as Object
+ => where { ... }
+
+will break if the Object:: namespace exists. So the
+solution is to quote 'Object', like so:
+
+ subtype Stuff
+ => as 'Object'
+ => where { ... }
+
+Moose 0.03 did this, now it doesn't, so all should
+be well from now on.
+
+=cut
+
+{ package Object::Test; }
+
+use_ok('Moose');