perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bevelock, Mike" <>
Subject Apache::Reload: explicitly registering required library files [p atch included]
Date Fri, 02 Jul 2004 15:52:28 GMT
A nice enhancement to Apache::Reload would be the ability to explicitly
"register" and reload required library files.

For example, if a sub in 'lib/' changed, it would be nice if
all code
that did this:

require 'lib/';

got the fresh code in lib/

The Apache::Reload->register_module method expects the "thing" your
to be in a "package" format (eg Foo::Bar).  It therefore calls
package_to_module, which converts
:: to /, and appends a .pm to the "thing", before adding it to

Therefore, this
doesn't work as one might expect.

I added this functionality to my local copy of Apache::Reload ver 0.07.

Appended to this mail is a diff of the change.

note: if ReloadAll is on, I believe that required libs do indeed get
I'm not setting ReloadAll and am explicidly registering modules (and libs).

Any comments to this change?
Should/could this be incorporated into Apache::Reload?

Thank you,
University at Buffalo

>diff -c
***   Thu Jul  1 16:07:15 2004
---       Thu Jul  1 16:07:45 2004
*** 28,33 ****
--- 28,40 ----
  sub register_module {
      my ($class, $package, $file) = @_;
+     if ($INC{$package}) { 
+       # if it's in %INC, it's already in "module" format,
+       # just add it to %Apache::Reload::INCS and return
+       $INCS{$package} = $INC{$package};
+       return;
+     }
      my $module = package_to_module($package);
      if ($file) {

Report problems:
Mail list info:
List etiquette:

View raw message