develooper Front page | perl.moose | Postings from February 2015

Re: incomplete role consumption?

Thread Previous | Thread Next
From:
Daniel Hermann
Date:
February 26, 2015 08:35
Subject:
Re: incomplete role consumption?
Message ID:
54EEDA5B.8050807@1und1.de
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



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About