NAME
Chj::ruse - reload modules
SYNOPSIS
use FP::Repl;
use Foo;
use Chj::ruse;
use Bar qw(biz bim);
repl;
# edit the Foo.pm or Bar.pm files, then (possibly from the repl):
> ruse; # reloads all changed modules, and re-does all imports
# which have happened for those modules since Chj::ruse has
# been loaded.
use Chj::ruse 'r'; # imports alias `r` for `ruse` (shorter to type)
DESCRIPTION
Extended copy of Module::Reload which modifies Exporter.pm so that exports are tracked, so that these are redone as well.
One function is exported: ruse. It does the equivalent of Module::Reload->check, and re-exports stuff as far as possible.
The function takes an optional argument: a temporary new debug level, which shadows the default one stored in $Chj::ruse::DEBUG. 0 means no debugging info. -1 means be very silent (set $^W to false, to prevent redefinitions of subroutines *which are NOT in the namespace being reloaded* (subroutines in the namespace being reoaded are deleted first, so there is never given a warning in this 'normal' case)).
BUGS
Each time import is called on a particular modules ("use Foo qw(biz baz)"), the previous import arguments from the previous call is forgotten. Thus if a module is use'd/import'ed multiple times in a row from the same source file, only part of the import list is remembered. Thus not everything is re-exported by ruse. (Can this be solved?)
Hm, if an error prevented a module from having been loaded, somehow reload doesn't (always?) work ? why?
This module might have problems with threads - I don't know if other threads might try to run subroutines which have been deleted before being defined again.
NOTE
This is alpha software! Read the status section in the package README or on the website.