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

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.

Replies are listed 'Best First'.
Re^4: Moose: Problems subtyping a coerced subtype
by BaldManTom (Friar) on Jan 22, 2015 at 13:10 UTC

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