Just another Perl shrine | |
PerlMonks |
Re^2: Two Moose classes consumering the same role and using each otherby v_melnik (Scribe) |
on Jun 26, 2014 at 12:42 UTC ( [id://1091353]=note: print w/replies, xml ) | Need Help?? |
No, problem, I'll add some actual code. Here is the role:
And here goest our "ClassA":
ClassB looks almost the same way:
Yes, ClassA and ClassB are quite short and quite similar, the differences are only in a couple of lines, because all their logic is coded in the Element role. Then my main module calls ClassA->find_related_to_me(...) and it needs to create a ClassB object for doing some tricks. The object is being created, everything works fine, but here are some warnings:
So it doesn't like that I defined element_type(), _load_full_list_command() and _generate_xpath_query() in MonkeyMan::CloudStack::Elements::Domain and then I require MonkeyMan::CloudStack::Elements::VirtualMachine where the same methods are defined as well. I'm pretty sure that my case isn't too "exotic" and many Perl developers are facing with the necessity of using "sibling" classes consuming the same role. Thank you!
V.Melnik
In Section
Seekers of Perl Wisdom
|
|