MooX::HandlesVia problem

[email protected] (Stephen Quinney) Wed, 19 Aug 2015 16:03:58 +0100
Newsgroups perl.moose
Message-ID <CAJ+y7SxQJRcWivOf72Ppad-FgoQLYGYCB3smZ4QXC-jEWSVUzA@mail.gmail.com>
--001a1140496420eeed051dab5809
Content-Type: text/plain; charset=UTF-8

I have a problem with using MooX::HandlesVia for attributes in roles when I
consume more than one role in a class. I get:

"Due to a method name conflict between roles 'SJQ::Role::Bar and
SJQ::Role::Foo', the method 'has' must be implemented by 'SJQ::Baz' at
/usr/share/perl5/vendor_perl/Role/Tiny.pm line 215."

I can't see what I'm doing wrong here, any suggestions?

Here's an example:

{
    package SJQ::Role::Foo;
    use Moo::Role;
    use MooX::HandlesVia;
}

{
    package SJQ::Role::Bar;
    use Moo::Role;
    use MooX::HandlesVia;
}

{
    package SJQ::Baz;
    use Moo;

    with 'SJQ::Role::Foo','SJQ::Role::Bar';

    use namespace::clean;
}

my $test = SJQ::Baz->new();

--001a1140496420eeed051dab5809
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I have a problem with using MooX::HandlesVia for attr=
ibutes in roles when I consume more than one role in a class. I get:<br><br=
>&quot;Due to a method name conflict between roles &#39;SJQ::Role::Bar and =
SJQ::Role::Foo&#39;, the method &#39;has&#39; must be implemented by &#39;S=
JQ::Baz&#39; at /usr/share/perl5/vendor_perl/Role/Tiny.pm line 215.&quot;<b=
r><br></div><div>I can&#39;t see what I&#39;m doing wrong here, any suggest=
ions?<br><br></div>Here&#39;s an example:<br><div><div><br>{<br>=C2=A0=C2=
=A0=C2=A0 package SJQ::Role::Foo;<br>=C2=A0=C2=A0=C2=A0 use Moo::Role;<br>=
=C2=A0=C2=A0=C2=A0 use MooX::HandlesVia;<br>}<br><br>{<br>=C2=A0=C2=A0=C2=
=A0 package SJQ::Role::Bar;<br>=C2=A0=C2=A0=C2=A0 use Moo::Role;<br>=C2=A0=
=C2=A0=C2=A0 use MooX::HandlesVia;<br>}<br><br>{<br>=C2=A0=C2=A0=C2=A0 pack=
age SJQ::Baz;<br>=C2=A0=C2=A0=C2=A0 use Moo;<br><br>=C2=A0=C2=A0=C2=A0 with=
 &#39;SJQ::Role::Foo&#39;,&#39;SJQ::Role::Bar&#39;;<br><br>=C2=A0=C2=A0=C2=
=A0 use namespace::clean;<br>}<br><br>my $test =3D SJQ::Baz-&gt;new();<br><=
br><br><br></div></div></div>

--001a1140496420eeed051dab5809--