Re: might_have problem
[prev]
[thread]
[next]
[Date index for 2005/01/08]
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
|
|
Re: might_have problem
Tony Bowden 13:13 on 08 Jan 2005
|