Re: might_have problem

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

From: Tony Bowden
Subject: Re: might_have problem
Date: 13:13 on 08 Jan 2005
On Sat, Jan 08, 2005 at 01:14:53PM +0100, Hartmaier Alexander wrote:
> I thought about defining four might_have statements, but the last
> overwrites all other 3 with the following warning messages:
> 
> Subroutine NAC::Device::snmpread redefined at
> /usr/local/share/perl/5.8.4/Class/DBI/Relationship.pm line 62.
> 
> Subroutine NAC::Device::chassismodel redefined at
> /usr/local/share/perl/5.8.4/Class/DBI/Relationship.pm line 62.
...
> 
> WHY?

> __PACKAGE__->might_have(device_router => 'NAC::Device_Router' =>
> qw/ipaddr snmpport snmpread serialnumber memory flashmem chassismodel/);

> __PACKAGE__->might_have(device_switch => 'NAC::Device_Switch' =>
> qw/ipaddr snmpport snmpread serialnumber memory flashmem chassismodel/);

Because each argument in the qw// lists you're passing to might_have
creates the method as a lookup on that class.

So each will overwrite the previous one.

You can't use might_have for this. You probably want to write you're own
Relationship type.

Tony

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