Re: might_have problem

[prev] [thread] [next] [Date index for 2005/01/10]

From: William McKee
Subject: Re: might_have problem
Date: 14:34 on 10 Jan 2005
On Sat, Jan 08, 2005 at 01:13:27PM +0000, Tony Bowden wrote:
> You can't use might_have for this. You probably want to write you're own
> Relationship type.

That seems like some tough advice for someone who is apparently confused
about one of the standard relationships.

Perhaps there is an alternative. If each entry in the master table has a
matching record in the sub-tables, I would think that a join using has_a
would be sufficient:

  __PACKAGE__->has_a(device_router => 'NAC::Device_Router');
  __PACKAGE__->has_a(device_switch => 'NAC::Device_Switch');

The data could then be accessed using the code that Alexander has
already written:

 print $obj_interface->device->device_switch->chassismodel . "\n";

Alexander, if you decide to take Tony's suggestion and write a custom
Relationship type, I would be interested in seeing your results. I can
think of at least one case where it would be useful for me.


William

        -- 
        Knowmad Services Inc.
http://www.knowmad.com

might_have problem
Hartmaier Alexander 12:14 on 08 Jan 2005

Re: might_have problem
Tony Bowden 13:13 on 08 Jan 2005

Re: might_have problem
William McKee 14:34 on 10 Jan 2005

Generated at 12:15 on 16 Jan 2005 by mariachi v0.52