Stas Bekman wrote:
Philippe M. Chiasson wrote:
Stas Bekman wrote:
Philippe M. Chiasson wrote:
Stas Bekman wrote:
After looking at the doc again, I think it's misleading to call this function unload_module. Since it's doesn't undo what the module has loaded. It unloads a specific stash (package name) no more and no less.
It's not quite that simple, it gets rids of a module in preparation for reloading it (eval "use $module").
It clears the module's stash It removes the module from %INC
oh i've missed that one. in fact remember that a module could be autovivified from anywhere. So make sure that it handles the case when you don't have a real module Foo/Bar.pm but you do have sub Foo::Bar::test inserted from another place.
Well, if you call unload_module("Foo::Bar") it will wipe out sub Foo::Bar::test {}
and fail to find Foo/Bar.pm in %INC and leave it alone.
perfect.
and please add that to the doc too.
Not sure what you want to see in there ?
That it attempts to remove Foo/Bar.pm from %INC when unload_module("Foo::Bar") is called. This is not obvious and better be documented.
Right, so not _stash, but neither _module. even Symbol calls it delete_package which is probably much closer, but still doesn't cover.
clean_namespace() clear_namespace() clean_package() clear_package()
I like clear_package(), clear_module() maybe ?
I'd go with the package, module may contain more than one package and therefore misleading. unload_package or clear_package sounds good. I think unload_package is a good choice.
Yeah, and the funny thing is that unload_package() is what the function is called currently. I just mistyped it when I documented it. So this thread can be safely forgotten now that I updated the documentation.
-- -------------------------------------------------------------------------------- Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5 http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
signature.asc
Description: OpenPGP digital signature