| Eric J. Roode on Fri, 27 Jun 2003 06:05:37 -0400 |
|
Greetings. I have sort of a thorny problem I've been chewing on for
a while.
I am developing a long-running process that will handle many disparate
things, so I don't want to shut it down unless absolutely necessary.
It will use OO modules written by other programmers, which may be in a
development state. I would like for my program to detect when any of
its included modules change, and then re-load that module (and its
dependencies, if any).
When I unload and reload, I will not be keeping any data structures
from the module around, so I don't have to worry about (for example)
the module's internal state or representation changing -- it will be
a clean start.
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.
So I thought I would delete all the subroutines and data by doing
%{$module.'::'} = (). That seemed to work, but inexplicably does not
work for one of my modules. It works fine for "Foo", "Bar",
"Foo::Bar", but when it gets to "Time::Format", it dies with a message
about not being able to promote that kind of scalar. (I apologize, I
don't have the exact error message in front of me). Very bizarre.
For the moment, I have my reload routine coded to simply skip any
module named "Time::Format". This is obviously lame... what OTHER
modules won't work?
Does anyone have any other suggestions?
--
Eric J. Roode sdn@comcast.net
$_ = reverse sort $/.r , qw p ekca ts lre reh
uJ p, map $_ . $" , qw e p h tona e and print
Attachment:
pgp4RXYoeV5MJ.pgp
|
|