Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Moose role with requirement consuming another role

by nysus (Parson)
on Feb 25, 2017 at 01:51 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1182778]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-03-28 23:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found