Hi Nick,
On 02/25/2015 10:35 PM, Nick Perez wrote:
You are correct in your deduction. And this is not Moose specific.
Circular dependencies like in your example cause undefined behavior
in Perl. What I don't understand is why you need the TestGlue class
or the circular dependency at all. Can you please take a step back
and explain what it is you are trying to accomplish?
in my application, I have the following entities:
Test1 == Node (a host node)
Test2 == Vm (a virtual host)
TestRole == HostRole (common parts of Node and Vm, with sub load_host())
TestGlue == Cluster (a cluster of host nodes and virtual hosts)
Node and Vm both consume the HostRole, which has a 'cluster' attribute.
Therefore, HostRole uses Cluster.
On the other hand, the Cluster class has some functionality that
operates on Node and Vm objects, such as representing or manipulating
all nodes and vms of the cluster. Therefore, it uses Node and Vm.
I understand that the problems indicate that there is some fundamental
class design flaw here.
regards,
Daniel
--
Daniel Hermann
Operations Developer
1&1 Internet AG