in reply to Unloading a module completely

If I understand you, the new module's subs and variables are getting defined, but there are subs and variables in the old that aren't in the new?

Perhaps you want Symbol::delete_package? But see its caveats regarding any code using the module's subs and variables that was compiled after the old module was.

It also doesn't do the delete $INC{foo} for you, but if you are using do instead of require, that's ok.

Replies are listed 'Best First'.
Re: Re: Unloading a module completely
by gmpassos (Priest) on Dec 08, 2003 at 10:56 UTC
    I already have worked with this way to clean a package at delete_package(), but this doesn't do all the job! Actually this code came from old Safe module, at erase() method.

    You really need to clean everything one by one, not only the symbol at the table! I say that because making memory comparations I saw that after 1000 times running a test code I use 150Mb when cleanning with delete_package(), and with my method (cleanning everything) I got 8Mb! ;-P

    Maybe I will post some fix to delete_package()...

    update: I'm saying that Safe::World::CLEAN() clean better the package, since I get only 8Mb in the tests with it.

    Graciliano M. P.
    "Creativity is the expression of the liberty".

      Are you saying you have a method based on Safe::erase that's better than Symbol::delete_package or saying that you have a delete_package based on Safe::erase and another method that is better than that? If the latter, can you explain more what it is that you do?
      For me delete_package() and Safe::erase() are the same (do the same thing). Looking for a better way to clean a package I have created a better method to clean a package, that you can see at Safe::World::CLEAN().

      Graciliano M. P.
      "Creativity is the expression of the liberty".