[pm-h] When to use "weaken"?
Michael R. Davis
mrdvt92 at yahoo.com
Fri Jan 24 06:44:41 PST 2014
>>
>> If I'm understanding you, that's the definition of a circular reference.
>>
>> parent -> child -> parent
>
Can't locate object method "cfg" via package "XXX::Profiles::Profile" at /usr/lib/perl5/vendor_perl/5.10.0/XXX/Profiles/Profile.pm line 112.
So, weaken must not work like I think. The child has lost the link to the parent. I guess the child to parent link is more important than the parent to child relationship. Maybe I need to weaken the parent ref. Maybe as Todd suggested I need to re-think the architecture.
For now I'm going to exit after a few loops and restart on cron with Sys::RunAlone or something like that.
Maybe I need to use a DESTROY block and undef($self->{"parent"}) in it. Anyone know the gotchas on DESTROY?
Thanks,
Mike
More information about the Houston
mailing list