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.

and please add that to the doc too.

Not sure what you want to see in there ?


It dl_closes the associated .so file if the module was DynaLoaded.


A module could have inserted things into other packages, and other modules may have added other things into the current package, and unload_module won't undo those and will overundo the others. So may be it's better to call it unload_stash?


Isn't that an understatement of what the function does ?


It's good that the name is not end user friendly (i.e. requires the knowledge of perl internals), since people shouldn't be using it, unless they know what they are doing.


Definetely. There are very few reasons why one would want to use something
like that. And we still know that as much as I might want to, _unloading_ a
Perl module isn't 100% feasible, really ;-(


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 ?

reset_namespace()
...


-- -------------------------------------------------------------------------------- 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

Attachment: signature.asc
Description: OpenPGP digital signature



Reply via email to