Yary has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to convert an existing module to use Moops instead of Devel::Declare, and as a side effect I find myself converting one of its sub-modules from MooseX::Types::Combine to Type::Library.

Perhaps this task is foolishness, as the project doesn't require this. In any case, I've hit this stumbling block:

package MyApp::Types; use strict; use warnings; use namespace::autoclean; use Type::Library -base; use Type::Utils 'extends'; BEGIN { extends 'Types::Standard'; extends 'MooseX::Types::DBIx::Class'; # extends 'MyApp::Types::Internal'; # Not needed for this } 1; __END__
This gives me the error "coercion => 1 requires type to have a direct parent with a coercion" on the line including MooseX::Types::DBIx::Class.

Does Type::Tiny's strictness about the coercion semantics preclude it from consuming MooseX::Types::DBIx::Class? If so, is there a replacement or work-around?

Replies are listed 'Best First'.
Re: Can Type::Tiny / Type::Library extend MooseX::Types::DBIx::Class?
by tobyink (Canon) on Mar 13, 2015 at 13:58 UTC

    This should work. It it does not, then I'd consider it to be a bug.

    If you take a look at the test case t/30-integration/MooseX-Types/extending.t then you'll see an example of a Type::Library library extending a MooseX::Types library. And if CPAN managed to install the software successfully, then this test must have passed on your machine.

    It is quite possible though that MooseX::Types::DBIx::Class in particular is doing something more complex than most MooseX::Types libraries do. (And knowing the DBIx::Class chaps, I'd say that's in fact quite likely!)

    TL;DR: Should work. If it doesn't, please file a big report.

      Thanks, will file a report ASAP!