* Moose::Object
- added &dump method, cause it makes all out lives
easier really.
+
+ * Moose::Meta::TypeConstraint
+ - added the &is_a_type_of method to check both the current
+ and the subtype of a method (similar to &isa with classes)
0.11 Wed. July 12, 2006
* Moose
use Carp 'confess';
use Scalar::Util 'blessed';
-our $VERSION = '0.03';
+our $VERSION = '0.04';
__PACKAGE__->meta->add_attribute('name' => (reader => 'name' ));
__PACKAGE__->meta->add_attribute('parent' => (reader => 'parent' ));
}
}
+sub is_a_type_of {
+ my ($self, $type_name) = @_;
+ ($self->name eq $type_name || $self->is_subtype_of($type_name));
+}
+
sub is_subtype_of {
my ($self, $type_name) = @_;
my $current = $self;
=item B<new>
-=item B<is_subtype_of>
+=item B<is_a_type_of ($type_name)>
+
+This checks the current type name, and if it does not match,
+checks if it is a subtype of it.
+
+=item B<is_subtype_of ($type_name)>
=item B<compile_type_constraint>