This is documented, sort of.

http://search.cpan.org/dist/Moose/lib/Moose/Manual/Types.pod#WHAT_IS_A_TYPE?

Any Moose type is automatically a type.  Any created type is a type.
Any reference to something unknown is assumed to be a type.  But the
magic breaks down when you've got complex expressions, pieces of which
are non-Moose classes.

So add in:

subtype 'Log::Any::Adaptor::Base', as 'Object', where
{$_->isa('Log::Any::Adaptor::Base')};
subtype 'Log::Any::Adapter::Null', as 'Object', where
{$_->isa('Log::Any::Adapter::Null')};

and it should work.

On Mon, Feb 18, 2013 at 3:22 PM, Caleb Cushing <xenoterrac...@gmail.com> wrote:
>
> the code,
>
> use Class::Load 0.20 'load_class';
> use Moose::Role;
>
> # VERSION
>
> #### Attribute Definitions ####
>
> has _log => (
>     isa     => 'Log::Any::Adapter::Base | Log::Any::Adapter::Null',
>     is      => 'ro',
>     lazy    => 1,
>     default => sub { load_class('Log::Any')->get_logger },
> );
>
>
> attached is the the stack trace, what about unions do I not
> understand? are they only allowed between moose native types? or am I
> doing something else that is obviously wrong?
>
>
> --
> Caleb Cushing
>
> http://xenoterracide.com

Reply via email to