if I delete the Dir, the Files can no longer reference the Dir
It's not only a question of deletion. The reference to Dir within File will disappear as soon as the Dir object gets out of scope, which is a Bad Thing™
use strict; use warnings; use Data::Dump; my $file = Practice::File->new('foo'); { my $dir = Practice::Dir->new('bar'); $file->add_dir($dir); } dd $file; __DATA__ bless({ dir => undef, name => "foo" }, "Practice::File")
Greetings,
-jo
In reply to Re: Should I use weaken on an object attribute containing a reference to an object which contains reference back to original object?
by jo37
in thread Should I use weaken on an object attribute containing a reference to an object which contains reference back to original object?
by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |