[Kc] dynamically loading and unloading perl packages

John Reinke jmreinke at sunflower.com
Fri Sep 12 00:24:16 CDT 2003

I've got a challenge that I just haven't been able to find a solution
for. I'll describe the feature I need to add to the application, in case
I'm headed in the wrong direction.

I have a script which runs constantly, watching another application. It
has certain tasks it performs, and occasionally needs to add and/or
subtract from the list of tasks it performs through checking to see if a
config file has changed.

Here's the tricky part: the tasks are performed by custom perl packages
that are not known until the config file is read. This means that the
main program needs to be able to dynamically load/initialize or unload
packages according to changes made to the config file since the last
time it was read.

I've not been able to figure out how to dynamically load or unload
packages within a global scope. The closest I've been able to find is
DynaLoader, which allows dynamically loading C libs into a perl program.

This seems like something that should be easy in perl, but I've not been
able to figure it out.

Any suggestions?


More information about the kc mailing list