You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by Fred Lovine <fr...@citylinkweb.com> on 2001/11/20 07:19:33 UTC

global.asa required file not reloading

Hi,

I have the following global.asa:
-------------
require "citylinkweb.pl";

-------------

But when the required file is edited, the changes do not take effect until
the Apache server is restarted.
Other files are reloading automatically. How do I get this file to
dynamically reload?

Here are my httpd.conf settings:
PerlSetVar Global  .
PerlSetVar StatINC 1
PerlSetVar DynamicIncludes 1
PerlSetVar Clean 0
PerlSetVar FileUploadMax 2500000
PerlSetVar FileUploadTemp 1
PerlSetVar Debug 2
PerlSetVar TimeHiRes 1

And for extra credit:
When the required file has a reference to
$main::Request->ServerVariables('SERVER_SOFTWARE') and is then edited, an
error is generated:

[Tue Nov 20 01:12:27 2001] [error] [asp] [844] [error] can't require/reload
citylinkweb.pl: Can't call method "Item" on an undefined value at
C:/CLW/Perl/site/lib/Apache/ASP.pm line 3298. <--> Compilation failed in
require at C:/CLW/Perl/site/lib/Apache/ASP.pm line 2374. <--> ,
C:/CLW/Perl/site/lib/Apache/ASP.pm line 2377

So, it seems that there is an attempt to reload the file. Subsequent calls
to the app however use the original file and without error, until the
required file is altered again.

Any insight into this one?

Thanks.

Fred Lovine
fred.lovine@citylinkweb.com


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: global.asa required file not reloading

Posted by Joshua Chamas <jo...@chamas.com>.
Fred Lovine wrote:
> 
> Hi,
> 
> I have the following global.asa:
> -------------
> require "citylinkweb.pl";
> 
> -------------
> 
> But when the required file is edited, the changes do not take effect until
> the Apache server is restarted.
> Other files are reloading automatically. How do I get this file to
> dynamically reload?
> 
> Here are my httpd.conf settings:
> PerlSetVar Global  .
> PerlSetVar StatINC 1

If StatINC does not work for you to reload this at runtime, you 
might try Apache::Reload to do so.  Reloading perl libraries at runtime 
can have lots of problems, and one is happy when it just works.

> And for extra credit:
> When the required file has a reference to
> $main::Request->ServerVariables('SERVER_SOFTWARE') and is then edited, an
> error is generated:
> 
> [Tue Nov 20 01:12:27 2001] [error] [asp] [844] [error] can't require/reload
> citylinkweb.pl: Can't call method "Item" on an undefined value at

I imagine that this might be from code being run that relies on 
$main::Request in this case being defined.  However $main::Request is
not necessarily defined during global.asa compilation or during
StatINC library reloading, so this call would need to be in a subroutine
for it to not error when $Request is being used.

> So, it seems that there is an attempt to reload the file. Subsequent calls
> to the app however use the original file and without error, until the
> required file is altered again.
> 

If you really want this file to be reloaded like an ASP script/include, 
you could:

sub Script_OnStart {
  do 'citylinkweb.pl';
}

or could load it similarly as an include if you wrap the code with <% %>

sub Script_OnStart {
  $Response->Include('citylinkweb.pl');
}

-- Josh

_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks Founder                       Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org