develooper Front page | perl.moose | Postings from November 2014

Re: nested roles are badly limited

Thread Previous | Thread Next
From:
moose
Date:
November 22, 2014 10:42
Subject:
Re: nested roles are badly limited
Message ID:
54706897.20902@hidden-primary.net
Hej John,

Am 21.11.2014 um 22:32 schrieb John Macdonald:
> ==== cat test1.pl
> package BRole;
> use Moose::Role;
> 
> requires 'b';
> 
> package ARole;
> use Moose::Role;
> 
> has 'b' => ( is => 'ro', isa => 'Scalar' );
> 
> package main;
> use Moose;
> with 'ARole', 'BRole';
> ====

just change it to this:

package BRole;
use Moose::Role;

requires 'b';

package ARole;
use Moose::Role;

has 'b' => (is => 'ro', isa => 'Scalar');

package main;
use Moose;
with 'ARole';
with 'BRole';

And you're done.

Kind regards

-- 
Marco

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About