Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://979026]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2017-02-23 14:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (347 votes). Check out past polls.