Module::Refresh(3)
okay bestie, welcome to the Module::Refresh(3) page π β yes, that's the manual name, and we're in the User Contributed Perl Documentation zone. This is all about refreshing %INC files when they get updated on disk. It's giving persistent-environment realness, so let's go β¨
πΈ NAME πΈ
Module::Refresh - Refresh %INC files when updated on disk. That's the whole vibe: your already-loaded Perl modules get a glow-up when the files on disk change. π
π¦ SYNOPSIS π¦
Bestie, here's the code, copied exactly so you can steal it:
# 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.pm');
π DESCRIPTION π
Okay so this module is a generalization of the functionality provided by Apache::StatINC and Apache::Reload. It's designed to make it easy to do simple iterative development when working in a persistent environment. π«Ά
It does not require mod_perl. Not me checking for mod_perl, because we don't need it. π
π new π
Initialize the module refresher. That's it β setup era, no drama. β¨
π₯ refresh π₯
refresh will refresh all modules that have mtimes on disk newer than the newest ones we've got. It calls new to initialize the cache if it had not yet been called. π
Specifically, it will renew any module that was loaded before the previous call to refresh (or new) and has changed on disk since then. Here's the plot twist, bestie: if a module was both loaded for the first time and changed on disk between the previous call and this one, it will not be reloaded by this call (or any future one). You will need to update the modification time again (by using the Unix touch command or making a change to it) in order for it to be reloaded. No cap. π
π refresh_module_if_modified $module π
If $module has been modified on disk, refresh it. Otherwise, do nothing. Chill. π
β 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. So don't come at it with double-colons, bestie β it wants the slash life. π
π§ unload_module $module π§
Remove a module from %INC, and remove all subroutines defined in it. Poof. π¨
π¦ mtime $file π¦
Get the last modified time of $file in seconds since the epoch; yes, epoch seconds, the classic timestamp vibe. β°
π update_cache $file π
Updates the cached "last modified" time for $file. Keeping the cache cute and current. π
π unload_subs $file π
Wipe out subs defined in $file. Bye-bye, subroutines. π
π BUGS π
Real talk: when we walk the symbol table to whack reloaded subroutines, we don't have a good way to invalidate the symbol table properly, so we mess up on things like global variables that were previously set. That's the messy part β no cap. π
π«Ά SEE ALSO π«Ά
Apache::StatINCModule::Reload
πΈ COPYRIGHT πΈ
Copyright 2004,2011 by Jesse Vincent <jesse@bestpractical.com>, Audrey Tang <audreyt@audreyt.org> π
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See <http://www.perl.com/perl/misc/Artistic.html> π
okay bestie, that's the page β sign-off time: perl v5.42.0, dated 2022-05-18. π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Module-Refresh 0.18-bp160.1.11 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms