again - mechanism for manually reloading modules when they've changed
use again 'LWP::Simple'; # default import use again 'LWP::Simple', ; # no import use again 'LWP::Simple', [qw(get)]; # import only get use again 'LWP::Simple', (); # default import (!!) use again 'LWP::Simple', qw(get); # import only get use again; require_again 'Foo::Bar';
This module provides a mechanism for manually reloading a module if its file has changed since it was first / previously loaded. This can be useful for long-running applications, where new versions of modules might be installed while the application is still running.
use again;, with no import list, will export
require_againinto your package. For historical reasons it will also export
use_again, which you shouldn't use (it will croak anyway).
use again MODULE, [ IMPORTS ];
If you do pass arguments, the first is used with
require_again, and all remaining arguments are used to import symbols into your namespace.
When given arguments,
use againdoes not export its own functions.
A single array reference is flattened. If that arrayref contains no elements, the import does not take place.
In mod_perl scripts, this of course only happens when your script is
evaled. This happens when your Apache::Registry or Apache::PerlRun script changes, or when your PLP script is requested.
This is the driving force behind
requires your module if it has not been loaded with
require_againbefore or it has changed since the last time
If you're imported a function from the module, then you'll need to re-import it after calling
use again 'Module::Path', qw(module_path); ... do some stuff ... require_again('Module::Path'); Module::Path->import('module_path');
If you don't do this then you'll end up running the version of the function that you first loaded.
Module::Reload provides a class method which checks all loaded modules to see if the file on disk has changed since the module was loaded.
Class::Unload unloads a class, by clearing out its symbol table and removing it from
There is no license. This software was released into the public domain. Do with it what you want, but on your own risk. The author disclaims any responsibility.
If you want to (re)distribute this module and need a license, you can redistribute it and/or modify it under the same terms as Perl itself.
Juerd Waalboer <email@example.com> <http://juerd.nl/>
Documentation updates from Neil Bowers.