|
|
Re: Apache::Reload - filtering include directories: msg#00263
apache.mod-perl
|
Subject: |
Re: Apache::Reload - filtering include directories |
I certainly agree with attaching a common prefix to a library, but what
if I am already dealing
with a bunch of modules written without prefix, and enough application
code using those packages ?
I suppose I could change the code, or alias names in symbol table, or do
some other trick;
I just figured that one extra directive, plus one patched line was a
cheap solution to my
problems.
I guess if nobody else sees any value in it, I'll just keep the private
patched version for myself :-)
Stas Bekman wrote:
Harry Danilevsky wrote:
Two reasons :
1. My site-specific modules don't necessarily have a common
namespace (or even several namespaces);
they just all live in /site/lib. Without a ReloadDirectories-like
filter every time I add another module,
say, /site/lib/Reports.pm I'll need to add Reports to ReloadModules,
and restart the server.
That's the thing. It's a good idea to alway use some prefix package
name in all your modules, to avoid future clashes with other modules.
And it automatically solves your problem with Apache::Reload.
2. Much more obscure, related to HTML::Mason. As I mentioned in my
post:
In Mason components are precompiled and cached, so that perl code
doesn't have to be re-parsed for every request.
The cached files are require(d), and they end up in %INC.
It appears from ReloadDebug's output that those cached files are
being checked by Apache::Reload,
and if they have been modified - they'll be reloaded. The problem is,
if the code has a syntax
error, that error will occur when Apache::Reload re-require()s that
file, and the error message
will be printed to a log file, not to the browser - which is what
Mason would do.
So your browser will simply tell you that 'Internal error has occurred'
ReloadDirectories will simply ignore them, and let Mason deal with
modified files.
If you tell Apache::Reload to look only at certain namespaces, this
problem doesn't exist anymore.
Am I still missing something ?
Harry Danilevsky
harry@xxxxxxxxxxxxxxxxxxxx
Stas Bekman wrote:
[...]
Anyway, I decided to add another directive to Apache::Reload
PerlSetVar ReloadDirectories "/site/lib /usr/local/apache/conf"
Apache::Reload allows you to define which modules to reload using
the patterns like so:
PerlSetVar ReloadAll Off
PerlSetVar ReloadModules "Apache::* My::*"
Is there any reason why you cannot use this approach?
I've no objection to your proposal, just wondering whether the
existing features can be used instead.
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxxxxxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
|
|