1Module::Refresh(3) User Contributed Perl Documentation Module::Refresh(3)
2
3
4
6 Module::Refresh - Refresh %INC files when updated on disk
7
9 # During each request, call this once to refresh changed modules:
10
11 Module::Refresh->refresh;
12
13 # Each night at midnight, you automatically download the latest
14 # Acme::Current from CPAN. Use this snippet to make your running
15 # program pick it up off disk:
16
17 $refresher->refresh_module('Acme/Current.pm');
18
20 This module is a generalization of the functionality provided by
21 Apache::StatINC and Apache::Reload. It's designed to make it easy to
22 do simple iterative development when working in a persistent
23 environment.
24
25 It does not require mod_perl.
26
27 new
28 Initialize the module refresher.
29
30 refresh
31 Refresh all modules that have mtimes on disk newer than the newest ones
32 we've got. Calls "new" to initialize the cache if it had not yet been
33 called.
34
35 Specifically, it will renew any module that was loaded before the
36 previous call to "refresh" (or "new") and has changed on disk since
37 then. If a module was both loaded for the first time and changed on
38 disk between the previous call and this one, it will not be reloaded by
39 this call (or any future one); you will need to update the modification
40 time again (by using the Unix "touch" command or making a change to it)
41 in order for it to be reloaded.
42
43 refresh_module_if_modified $module
44 If $module has been modified on disk, refresh it. Otherwise, do nothing
45
46 refresh_module $module
47 Refresh a module. It doesn't matter if it's already up to date. Just
48 do it.
49
50 Note that it only accepts module names like "Foo/Bar.pm", not
51 "Foo::Bar".
52
53 unload_module $module
54 Remove a module from %INC, and remove all subroutines defined in it.
55
56 mtime $file
57 Get the last modified time of $file in seconds since the epoch;
58
59 update_cache $file
60 Updates the cached "last modified" time for $file.
61
62 unload_subs $file
63 Wipe out subs defined in $file.
64
66 When we walk the symbol table to whack reloaded subroutines, we don't
67 have a good way to invalidate the symbol table properly, so we mess up
68 on things like global variables that were previously set.
69
71 Apache::StatINC, Module::Reload
72
74 Copyright 2004,2011 by Jesse Vincent <jesse@bestpractical.com>, Audrey
75 Tang <audreyt@audreyt.org>
76
77 This program is free software; you can redistribute it and/or modify it
78 under the same terms as Perl itself.
79
80 See <http://www.perl.com/perl/misc/Artistic.html>
81
82
83
84perl v5.34.1 2022-05-20 Module::Refresh(3)