"Daniel Muey via RT" <bug-Class-Unload@rt.cpan.org> writes:
Show quoted text> Class::Unload->unload("Cwd");
> say Cwd->VERSION; # undef, i.e. was unloaded
This is because UNIVERSAL::VERSION() looks up the packages $VERSION
variable at runtime using hv_fetchs(pkg, "VERSION", FALSE).
Show quoted text> say $Cwd::VERSION; # still gives the version! i.e. not unloaded
> say Cwd::cwd(); # still gives the current dir! i.e. not unloaded
These, on the other hand, were bound at compile time, and don't go
through the symbol table at runtime. This is how e.g. namespace::clean
can remove imported functions from the symbol table at the end of
compilation, so they can't be called as methods.
If you wrap the before-unload tests, the unload call and the
after-unload tests in separate BEGIN blocks, you'll see the results
you're expecting.
--
"A disappointingly low fraction of the human race is,
at any given time, on fire." - Stig Sandbeck Mathisen