Note that there are some explanatory texts on larger screens.

plurals
  1. POComposing Roles into a Moose class not working
    primarykey
    data
    text
    <p>Aloha!</p> <p>I have a role that I'm busy defining in a Moose class called Authable that is essentially composed into any class that might potentially require some form of authentication in the future; it's a rather simple role, here's the entirety:</p> <pre><code>package Trello::API::Roles::Authable; use Moose::Role; #authentication information has key =&gt; ( is =&gt; "rw", isa =&gt; "Str", ); has token =&gt; ( is =&gt; "rw", isa =&gt; "Str", ); 1; </code></pre> <p>For whatever reason, when I attempt to compose it into a class using multiple different statements, i.e., with "Trello::API::Roles::Authable"; or with "Roles::Authable";</p> <p>I consistently get this same error message: <code>You can only consume roles, Roles::Authable is not a Moose role.</code></p> <p>Any idea why this might be happening?</p> <p>Edit!</p> <p>Just a side note, I checked the actual source for Moose::Role, and saw this bit:</p> <pre><code> unless ($meta &amp;&amp; $meta-&gt;isa('Moose::Meta::Role') ) { require Moose; Moose-&gt;throw_error( "You can only consume roles, " . $role-&gt;[0] . " is not a Moose role" ); } </code></pre> <p>This seems to be where the error is occuring, so it almost seems that for some reason, the role I'm implementing isn't stating that it's a role in the metaclass. Though I could be mistaken! Any help would be appreciated.</p> <p>Another convenient EDIT!</p> <p>Bonus: Code context wherein the with routine is called.</p> <pre><code>package Trello::API::Resource; use Moose; use URI::Escape; use LWP::UserAgent; with 'Roles::Authable'; </code></pre> <p>which when I do this, it intelligently knows to try and consume Roles/Authable.pm but for whatever reason, it just fails to function!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload