in reply to Re^4: Refresh a Module
in thread Refresh a Module
Two very, very different things.
The delete removes the typeglob from the stash. This doesn't necessarily destroy the typeglob if it's still referenced elsewhere (like in another stash, compare refcount and garbage collection).
Anyway, the sub's ref is in the CODE slot of the typeglob!
Same story, destroying the typeglob doesn't mean destroying the sub, if it's referenced elsewhere.
(Think of a typeglob like of a hash with only 6 slots, CODE is one of them)
I could do a lot of experiments now to determine the internal mechanisms, question is rather if we are even allowed to rely on them. And others here know the C code better.
Fact is that we already have clean interfaces for subs
Please keep in mind that typeglobs are a Perl4 mechanism, refs came with Perl5. Not sure to which degree refcounts and garbage collection are applied to typeglobs and/or their slots.
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
|
|---|