Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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 perusing the Monastery: (12)
As of 2014-09-19 14:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (140 votes), past polls