Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: moose role that uses a class that does the role

by chromatic (Archbishop)
on Jun 29, 2012 at 01:45 UTC ( #979026=note: print w/ replies, xml ) Need Help??


in reply to Re^2: moose role that uses a class that does the role
in thread moose role that uses a class that does the role

What if you made the role parametric in one way or another? The role could require the presence of a method (created_class_name()) which Group could provide and, in this case, returns only the string 'Group'. That would decouple the class and the role, at least in the code you've shown here.

Another approach is to use MooseX::Role::Parameterized and pass in the class name when you compose the role.


Improve your skills with Modern Perl: the free book.


Comment on Re^3: moose role that uses a class that does the role
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://979026]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2014-12-21 09:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (104 votes), past polls