This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.
Subject: Re: RFC: Apache::Reload From: Michael Robinton <michael@bizsystems.com> Date: Sat, 12 Aug 2000 11:44:55 -0700 (PDT) On Sat, 12 Aug 2000, Leslie Mikesell wrote: > According to Matt Sergeant: > > > > package Apache::Reload; > > What I've always wanted along these lines is the ability > to load something in the parent process that would take > a list of directories where modules are always checked > and reloaded (for your local frequently changed scripts) > plus one filename that is checked every time and if it I use this simple library module. It is called from the beginning of the first script encountered in a set of scripts. This substitutes for a require statement for the corresponding modules. Call as: unshift @INC, './lib'; require 'LibChk.pl'; &LibChk::Install ( # check libraries for currency 'WhoisLib.pl', 'SocksLib.pl', 'DomRegLib.pl', ); library: #!/usr/bin/perl # # LibChk.pl # # version 1.01 6-16-00 # copyright Michael Robinton michael@bizsystems.com # # WARNING!! httpd must be 'HUP'ed if this library is modified # # check for library changes and load if necessary or not present # package LibChk; use vars qw ( %Modified ); # library modification times # Input: list of libraries (path must be in @INC) sub Install { foreach my $i (@_) { if ( ! exists $Modified{$i} || # if undefined time ! exists $INC{$i} || # missing $Modified{$i} != (stat "./$INC{$i}" )[9] ) { # or changed delete $INC{$i} if defined $INC{$i}; require $i; $Modified{$i} = (stat "./$INC{$i}" )[9]; } } } 1; ===