Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Moose role with requirement consuming another role

by nysus (Vicar)
on Feb 25, 2017 at 01:51 UTC ( #1182778=note: print w/replies, xml ) Need Help??


in reply to Moose role with requirement consuming another role

I'm almost 6 years late to this conversation but this worked for me:

{ package MyOpenSSH 0.000001; use Moose::Role; has 'ssh' => (is => 'rw', isa => 'Str', required => 0, lazy => 0 ); } { package Apache2Info 0.000001; use Moose::Role; requires 'ssh'; } { package WebServerRemote 0.000001; with 'MyOpenSSH'; with 'Apache2Info'; }

The trick seems to have been to put the with statements on two different lines and putting the role with the required attribute first in the list.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2019-09-16 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (186 votes). Check out past polls.

    Notices?