in reply to Re: Moose: Problems subtyping a coerced subtype
in thread Moose: Problems subtyping a coerced subtype

Thanks duelafn, and especially thanks for the link. I didn't know that coercions were not inherited. Ah well. Since the subtypes are in different files, I'll either need to duplicate code or make other arrangements.

Thanks again, I appreciate you taking time to help.

  • Comment on Re^2: Moose: Problems subtyping a coerced subtype

Replies are listed 'Best First'.
Re^3: Moose: Problems subtyping a coerced subtype
by kennethk (Abbot) on Jan 21, 2015 at 19:54 UTC
    You shouldn't need to duplicate code; as via can take a code ref in addition to a block, define an actual subroutine in the parent class and grab its reference via fully qualified package; or use introspection to traverse the coercion map (Moose::Meta::TypeCoercion). The former will be more obvious from casual inspection, and the latter would be more robustly maintainable.

    Neither is particularly elegant, though.


    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

      Good to know, kennethk. Thanks for the info. I'll look into both suggestions. Thanks for taking the time to help.