Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2020-09-29 17:34 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (150 votes). Check out past polls.