Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Moose role with requirement consuming another role

by Boldra (Deacon)
on Jul 20, 2011 at 12:49 UTC ( #915646=note: print w/ replies, xml ) Need Help??


in reply to Re: Moose role with requirement consuming another role
in thread Moose role with requirement consuming another role

I can see how my simplified example matches that description of an interface role, but in reality the Logger Role has six attributes and 200 lines of code, it's not just a list of 'requires'.

"this type of usage doesn't seem to be (officially) supported" == "I can't find it in the doc either"

?



- Boldra


Comment on Re^2: Moose role with requirement consuming another role
Re^3: Moose role with requirement consuming another role
by Arunbear (Parson) on Jul 20, 2011 at 14:16 UTC
    Role::App being used like an abstract base class is what is at odds with the documentation (regardless of whether or not the Logger Role is an interface type role).
      No, none of my roles are abstract base classes, they all provide additional functionality. Role::App reads the config file, creates objects based on its contents, and provides methods for fetching these objects.

      Anyway, I can't see how a class which inherits from another class (or a role) could be called an abstract base class - it's not at the base. But perhaps you are using a different definition.



      - Boldra
        In a Java-like language, an abstract base class is often used to provide functionality (often mandated by some interface) to classes that inherit from it, but it cannot be used/instantiated on its own. "abstract" means that it can't be instantiated, it doesn't mean that it provides no functionality.

        This is how you are using Role::App. It is like an an abstract base class in the sense that it can't be instantiated and it provides functionality to App::FixIt. Some of that functionality is mandated by Role::Logger. What the docs are saying is that mandated methods have to be supplied in classes not in roles.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2014-09-02 22:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (32 votes), past polls