use Mouse::Meta::TypeConstraint;
use Mouse::Exporter;
-use Carp ();
+use Carp ();
+use Scalar::Util ();
Mouse::Exporter->setup_import_methods(
as_is => [qw(
return subtype $name => (
as => 'Object',
optimized_as => sub {
- return Mouse::Util::does_role($_[0], $role);
+ return Scalar::Util::blessed($_[0])
+ && Mouse::Util::does_role($_[0], $role);
},
role => $role,
);
}
sub _find_or_create_union_type{
- return if grep{ not defined } @_;
- my @types = sort map{ $_->{type_constraints} ? @{$_->{type_constraints}} : $_ } @_;
+ return if grep{ not defined } @_; # all things must be defined
+ my @types = sort
+ map{ $_->{type_constraints} ? @{$_->{type_constraints}} : $_ } @_;
my $name = join '|', @types;
=head1 VERSION
-This document describes Mouse version 0.85
+This document describes Mouse version 0.88
=head2 SYNOPSIS