Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Role Composition versus Inheritance

by Arunbear (Prior)
on Feb 09, 2016 at 17:45 UTC ( [id://1154748]=note: print w/replies, xml ) Need Help??


in reply to Role Composition versus Inheritance

Moose (2.1604) behaves the same way:
use warnings; use strict; use feature qw{ say }; { package MyRole; use Moose::Role; sub where { 'Role' } sub role { 'yes' } } { package MyClass; sub new { bless {}, shift } sub where { 'Class' } } { package MyHeir; use Moose; extends 'MyClass'; with 'MyRole'; } my $h = 'MyHeir'->new; say $h->$_ for qw( where role ); __END__ Prints: Role yes
So the behavior is at least consistent albeit not adequately documented.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-23 22:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found