As I already said, this is a design problem of this "file system simulation" , and not weaken's
I have trouble imagining a file system where dirs and files are deleted implicitly after "falling out of scope".
Personally I would make deletion explicit with ->remove methods, and keep strong refs of the objects only in an %instance hash of the class, all other internal refs must be weak. Like this the refcount can not become 0 unless explicitly wanted.
Now if there are still other external refs when ->remove is called, this must be resolved.
Either they are all weak, because the constructor returned them weak and they'll become automatically undef after distruction.
Or they are strong and the refcount is checked by ->remove and throws an error "can't remove, still in use"
Bottom line: This scenario is too complicated to discuss weaken
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
In reply to Re^2: Should I use weaken on an object attribute containing a reference to an object which contains reference back to original object?
by LanX
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: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |