NAME
Module::Refresh - Refresh %INC files when updated on disk
SYNOPSIS
# During each request, call this once to refresh changed modules:
Module::Refresh->refresh;
# Each night at midnight, you automatically download the latest
# Acme::Current from CPAN. Use this snippet to make your running
# program pick it up off disk:
$refresher->refresh_module('Acme::Current');
DESCRIPTION
This module is a generalization of the functionality provided by Apache::StatINC. It's designed to make it easy to do simple iterative development when working in a persistent environment.
new
Initialize the module refresher.
refresh
Refresh all modules that have mtimes on disk newer than the newest ones we've got. Calls new
to initialize the cache if it had not yet been called.
refresh_module $module
Refresh a module. It doesn't matter if it's already up to date. Just do it.
Note that it only accepts module names like Foo/Bar.pm
, not Foo::Bar
.
unload_module $module
Remove a module from %INC
, and remove all subroutines defined in it.
mtime $file
Get the last modified time of $file in seconds since the epoch;
unload_subs $file
Wipe out subs defined in $file.
BUGS
When we walk the symbol table to whack reloaded subroutines, we don't have a good way to invalidate the symbol table.
SEE ALSO
Apache::StatINC, Module::Reload
COPYRIGHT
Copyright 2004 by Jesse Vincent <jesse@bestpractical.com>, Autrijus Tang <autrijus@autrijus.org>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.