You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Carl Brewer <ca...@bl.echidna.id.au> on 2004/11/10 03:55:54 UTC

[mp2] modperl not reloading files when changed

Hello,

I've got a couple of files, a script and a library, and
I'm not sure of what I'm doing wrong in terms of telling
modperl to watch them for changes.
I have the following in httpd.conf :

for my virtual host :

     PerlModule Apache2
     PerlRequire "/home/benfab/lib/startup.pl"

     PerlModule Apache::Reload
     PerlModule Apache::Request
     PerlModule Apache::Cookie
     PerlInitHandler Apache::Reload
     # PerlSetVar ReloadAll Off

   <Location /perl/>
     SetOutputFilter DEFLATE
     #SetHandler perl-script
     SetHandler modperl
     PerlResponseHandler ModPerl::Registry
     PerlOptions +ParseHeaders
     PerlOptions +GlobalRequest
     Options +ExecCGI
   </Location>


startup.pl has :

# http://perl.apache.org/docs/2.0/user/config/config.html

use Apache2 ();
   use lib qw(/home/benfab/lib);

   use ModPerl::Util (); #for CORE::GLOBAL::exit

   use Apache::RequestRec ();
   use Apache::RequestIO ();
   use Apache::RequestUtil ();

   use Apache::ServerRec ();
   use Apache::ServerUtil ();
   use Apache::Connection ();
   use Apache::Log ();

   use APR::Table ();
   use APR::Pool ();

   use ModPerl::Registry ();

   use Apache::Const -compile => ':common';
   use APR::Const -compile => ':common';

1;


Do I need to put something in my script and library
to tell Apache/mod_perl to watch them?

This is in my library :
# tell Apache we're volatile, watch for changes ...
use Apache::Reload;

Does that also need to be in my calling script for it to
be noticed?

thanks!

Carl











-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [mp2] modperl not reloading files when changed

Posted by Stas Bekman <st...@stason.org>.
Carl Brewer wrote:
> 
> Hello,
> 
> I've got a couple of files, a script and a library, and
> I'm not sure of what I'm doing wrong in terms of telling
> modperl to watch them for changes.
> I have the following in httpd.conf :
> 
> for my virtual host :
> 
>     PerlModule Apache2
>     PerlRequire "/home/benfab/lib/startup.pl"
> 
>     PerlModule Apache::Reload
>     PerlModule Apache::Request
>     PerlModule Apache::Cookie
>     PerlInitHandler Apache::Reload
>     # PerlSetVar ReloadAll Off
> 
>   <Location /perl/>
>     SetOutputFilter DEFLATE
>     #SetHandler perl-script
>     SetHandler modperl
>     PerlResponseHandler ModPerl::Registry
>     PerlOptions +ParseHeaders
>     PerlOptions +GlobalRequest
>     Options +ExecCGI
>   </Location>
> 
> 
> startup.pl has :
[...]
> Do I need to put something in my script and library
> to tell Apache/mod_perl to watch them?
> 
> This is in my library :
> # tell Apache we're volatile, watch for changes ...
> use Apache::Reload;
> 
> Does that also need to be in my calling script for it to
> be noticed?

Apache::Reload doesn't watch scripts but only modules that declare package 
names. ModPerl::Registry watches only the scripts it invokes (but not any 
files required by those scripts). Nothing watches .pl lib files.

So if you want to have your code reloaded, make sure they are modules and 
declare the packages.

for more infro please refer to:
http://perl.apache.org/docs/2.0/api/Apache/Reload.html
http://perl.apache.org/docs/2.0/api/Apache/Reload.html#Debug


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html