in reply to Re^5: Is there a better way to do this?
in thread Is there a better way to do this?

Have you loaded Moo::Role anywhere? I can reproduce the issue if I don't load it. Replacing line 4 with

use Moo::Role ();

should fix it without issues with redefined subroutines.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^7: Is there a better way to do this?
by 1nickt (Canon) on Mar 19, 2016 at 19:49 UTC

    Yeah, that does the trick. I was misled because when you try to use Moo::Role; with use Moo;, it doesn't report the redefined subs error, but just says Cannot import Moo::Role into a Moo class.

    So then it's basically just the same as use Role::Tiny() I guess ... maybe a slightly larger footprint, in fact. In my real application I don't use has() in the children, so can just use Role::Tiny; there, with use Role::Tiny() in the parent to get apply_roles_to_package().

    Thanks again.


    The way forward always starts with a minimal test.