From: Yuval Kogman Date: Fri, 4 May 2007 19:07:28 +0000 (+0000) Subject: accept objects in ->{isa} too X-Git-Tag: 0.18_01~88 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8a9cea9b88ab2900b7c7fd9d463d1f1ba79f6a63;p=gitmo%2FMooseX-AttributeHelpers.git accept objects in ->{isa} too --- diff --git a/lib/MooseX/AttributeHelpers/Base.pm b/lib/MooseX/AttributeHelpers/Base.pm index 1564d93..09ae2f1 100644 --- a/lib/MooseX/AttributeHelpers/Base.pm +++ b/lib/MooseX/AttributeHelpers/Base.pm @@ -106,4 +106,4 @@ L This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. -=cut \ No newline at end of file +=cut diff --git a/lib/MooseX/AttributeHelpers/Collection/Array.pm b/lib/MooseX/AttributeHelpers/Collection/Array.pm index 77eabd8..8e0e36c 100644 --- a/lib/MooseX/AttributeHelpers/Collection/Array.pm +++ b/lib/MooseX/AttributeHelpers/Collection/Array.pm @@ -58,7 +58,8 @@ sub _process_options_for_provides { (exists $options->{isa}) || confess "You must define a type with the Array metaclass"; - (find_type_constraint($options->{isa})->is_a_type_of('ArrayRef')) + my $c = find_type_constraint($options->{isa}) || $options->{isa}; + ( $c && blessed($c) && $c->is_a_type_of('ArrayRef')) || confess "The type constraint for a Array ($options->{isa}) must be a subtype of ArrayRef"; } @@ -117,4 +118,4 @@ L This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. -=cut \ No newline at end of file +=cut