Re: Apache::Reload - filtering include directories

2002-11-28 Thread Stas Bekman
Stas Bekman wrote:

Harry Danilevsky wrote:


I did send the patch to Matt couple of days ago, but haven't heard 
back yet.


Matt is on vacation


I suppose I can also brace myslef, add namespaces, and clean up my own 
code.


That's a good idea.


As for the versioning, if this patch could be useful in both mod_perl 
1.* and 2.0,
can it be applied to both distributions? I don't quite understand why 
installing
Apache::Reload from CPAN will cause mod_perl2.0 to be installed, but I'll
try to think some more about it.


Because Apache::Reload is distributed on CPAN and is not a part of 
mod_perl 1.0. And a genetically modified version is included in mod_perl 
2.0. The right solution is probably to make Apache::Reload a part of 
mod_perl 1.0 as well and kill the CPAN version, or simply have a higher 
number on it. So people won't need to install it manually.

I've committed your patch to the Apache::Reload version distributed with 
mod_perl 2.0 (plus documented the new feature). I've no control over the 
mod_perl 1.0 version maintained by Matt.

Thanks for the patch Harry.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Re: Apache::Reload - filtering include directories

2002-07-30 Thread Stas Bekman

[...]
 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 BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: Apache::Reload - filtering include directories

2002-07-30 Thread Harry Danilevsky

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.  

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.

Am I still missing something ?


Harry Danilevsky
[EMAIL PROTECTED]

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 BekmanJAm_pH -- Just Another mod_perl Hacker
 http://stason.org/ mod_perl Guide --- http://perl.apache.org
 mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
 http://modperlbook.org http://apache.org   http://ticketmaster.com






Re: Apache::Reload - filtering include directories

2002-07-30 Thread Stas Bekman

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
 [EMAIL PROTECTED]
 
 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 BekmanJAm_pH -- Just Another mod_perl Hacker
 http://stason.org/ mod_perl Guide --- http://perl.apache.org
 mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
 http://modperlbook.org http://apache.org   http://ticketmaster.com
 
 
 



-- 


__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: Apache::Reload - filtering include directories

2002-07-30 Thread Harry Danilevsky

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
 [EMAIL PROTECTED]

 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 BekmanJAm_pH -- Just Another mod_perl Hacker
 http://stason.org/ mod_perl Guide --- http://perl.apache.org
 mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
 http://modperlbook.org http://apache.org   http://ticketmaster.com