mjd-perl-pm on Fri, 27 Jun 2003 08:38:52 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Unload a module?


> My first thought was simply to delete the module from %INC, then eval
> a "use $module".  That seems to work, but I get lots of warnings about
> subroutines being redefined, as the module is re-loaded and re-compiled
> and tries to include and re-compile all its dependent modules.

It seems to me that the right way to deal with that is to turn off
warnings while you're reloading.  Maybe the *only* right way.
Nobody's going to be listening to those warnings anyway.

> So I thought I would delete all the subroutines and data by doing
> %{$module.'::'} = ().  That seemed to work,

You ar eon thin ice here.  If I were you, I would use the standard
'Symbol' module, which has a delete_package function in it.  Then you
would have someone else to blame if it did not work.

> Does anyone have any other suggestions?

Hope this helps.
-
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**