plainblack.com Username Password
Click here to register.
| View Cart (0)
download WebGUI now
search  

     Re: Stop & Start

Stop & Start

User fishingfan
Date 9/19/2006 6:10 am
Views 2114
Rating 1    Rate [
|
]
Previous · Next
User Message
fishingfan

Is there a way of getting the WebGUI to pick up new asset code without having to stop/start the wre ?

Currently I am changing a bit of code, then stop / start webgui to make it pick it up the change.  Or is this the price of mod_perl on a dev machine ?

Cheers 

Chris

CA-Dev.co.uk 



Back to Top
Rate [
|
]
 
 
crythias

well... there is Apache2::Reload, though I don't know what the performance hit will be. I'd suggest it not remain in production.

--
Maintainer of an unofficial WebGUI FAQ Please contribute questions or answers!
When asking questions on this forum, please indicate (at least) which version of WebGUI you are using. Optional, but sometimes helpful, are your Operating System name and version, PERL version, and Apache version. The little icons next to my picture indicate my IM status. Yes, you are welcome to IM me. I am not an employee of Plain Black. My offers of assistance are subject to the general disclaimer of this discussion board that my answer may be completely wrong. Have a great day!
www.gwy.org U2U crythias on #webgui on irc.freenode.net



Back to Top
Rate [
|
]
 
 
crythias

Actually, if you use the

PerlSetVar ReloadTouchFile /tmp/reload_modules

Option, you could leave it in and probably not take the big hit of constantly monitoring :).

--
Maintainer of an unofficial WebGUI FAQ Please contribute questions or answers!
When asking questions on this forum, please indicate (at least) which version of WebGUI you are using. Optional, but sometimes helpful, are your Operating System name and version, PERL version, and Apache version. The little icons next to my picture indicate my IM status. Yes, you are welcome to IM me. I am not an employee of Plain Black. My offers of assistance are subject to the general disclaimer of this discussion board that my answer may be completely wrong. Have a great day!
www.gwy.org U2U crythias on #webgui on irc.freenode.net



Back to Top
Rate [
|
]
 
 
fishingfan

Hmmm

This looks good.  Not sure how to get it working yet.

(am using the windows wre on a laptop for this)

Installed the Apache2:Reload via  ppm

Added the following statements to httpd.modperl.conf

PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload

after the existing line

PerlRequire "c:/data/WebGUI/sbin/preload.perl" (line 179).

Added use Apache2:Reload to my Asset/Wobject.

Changed the following in preload.perl

    #my $use = "use ".$package." ()";
    my $use = "require ".$package."; ".$package."->import();";

after seeing the info on this page

http://perl.apache.org/docs/2.0/api/Apache2/Reload.html#Problems_with_Scripts_Running_with_Registry_Handlers_that_Cache_the_Code 

But it still does not seem to pick up the changed code.  Any ideas as to what I may of missed ?

Cheers 

Chris

CA-Dev.co.uk 



Back to Top
Rate [
|
]
 
 
xdanger

There was a discussion about this on the old developer list:

https://mail.plainblack.com:8443/Lists/webguidev-old/Message/3313.html?Language= 



Back to Top
Rate [
|
]
 
 
fishingfan

Thanks matink and xdanger that's exactly what I was looking for.

On the windows wre v1.0 I did the following to get the Apache2::Reload to work for a development machine.

I changed the www.example.com.modperl file (C:\data\wre\etc\www.example.com.modperl) to look like below

Basically it comments out the PerlInitHandler Webgui and adds the two lines with Apache2::Reload in them.

Then restart your wre and it works! Laughing Check by changing something simple like adding a write to the log.

<VirtualHost *:81>
    ServerName www.example.com
    DocumentRoot /data/domains/www.example.com/public
        SetHandler perl-script
        #PerlInitHandler WebGUI
        PerlModule Apache2::Reload
        PerlInitHandler Apache2::Reload WebGUI
        PerlSetVar WebguiConfig www.example.com.conf
</VirtualHost>

 One oddity that did occur in the bit of code am using have the following error catching code that causes an error when using the Reload thingy on the reload of a changed module - not a prob as I can comment out when developing anyway.  Complains in the apache error log of a Global symbol "%session" requires explicit package error.

Here's the bit of code it hates with Apache2::Reload working (otherwise it's been fine)

  if($session{env}{MOD_PERL}) {
       my $r;
           if ($mod_perl::VERSION >= 1.999023) {
                       $r = Apache2::RequestUtil->request;
                   } else {
                        $r = Apache->request;
                   }
           if(defined($r)) {
                   $r->custom_response(401, $i18n->get("problem contact") );
                   $r->status(401);
           }
   } else  {
           $session{header}{status} = 401;
   }

I guess the $session variable is not available until you restart the wre again. 

  

Chris

CA-Dev.co.uk 



Back to Top
Rate [
|
]
 
 
martink
You can set up the wre as dev instance. This will include
Apache2::Reload in the httpd.conf, which automatically refreshes change
perl modules. If you installed the wre as a dev box however, this module
is not enabled. You can still do that of course. See
http://search.cpan.org/~pgollucci/mod_perl-2.0.2/docs/api/Apache2/Reload.pod.
But keep in mind that this will slow down your system, and that it
should not be used on a production machine.

Martin


fishinginwessex@hotmail.com wrote:
> fishingfan wrote:
>
> Is there a way of getting the WebGUI to pick up new asset code without
> having to stop/start the wre ?
>
> Currently I am changing a bit of code, then stop / start webgui to
> make it pick it up the change.  Or is this the price of mod_perl on a
> dev machine ?
>
> Cheers
>
> Chris
>
> CA-Dev.co.uk <http://www.ca-dev.co.uk/>
>
>
>
> http://www.plainblack.com/webgui/dev/discuss/stop--start
>
> Unsubscribe
> <http://www.plainblack.com/webgui/dev/discuss?func=unsubscribe>
>
> ------------------------------------------------------------------------
>
>
>
>  



Back to Top
Rate [
|
]
 
 
     Re: Stop & Start



© 2009 Plain Black Corporation | All Rights Reserved