The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Jabber::Reload - reload modules

DESCRIPTION

Reload is a helper module to reload modules that have changed during run time.

it is a bit of a copy of Apache::Reload, but not nearly as sophisticated, it just check the time stamp on the file of a module that is registerd, whacks the INC entry for it and then reloads over the top.

EXAMPLES

in the main of your program:

use Jabber::Reload;

Jabber::Reload::register(q|Some::Module|);

.... later during the loop

if ( Jabber::Reload::haveModule(q|Some::Module|) ){
   Jabber::Reload::reload(q|Some::Module|);
} else {
   Jabber::Reload::loadModule(q|Some::Module|);
}

also - to ensure that modules loaded and registered by Reload are properly available in the current scope, when using JabberReload::loadModule(), you must put the load in a BEGIN {} block like so:

use Reload;
BEGIN { Jabber::Reload::loadModule("TTest"); };

so that you can still address methods like this: TTest::handler;

as opposed to having to do this: TTest->handler;

AUTHOR

Piers Harding - after a lot of plagarism