You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by cl...@stanfordalumni.org on 2000/10/24 21:05:37 UTC

Apache::ASP problems with Global, global.asa, 'use lib' and @INC

The problem is that I specify a dirname for the Global perl var on my httpd.conf and Apache::ASP fails to push it on @INC. This problem is circumvented if I create a global.asa file (even an empty one) in the directory I specify for the Global var. If I do this then the path is correctly pushed onto @INC.

It took me a while to discover the global.asa trick. I think this is a bug because global.asa should always be optional on ASP apps. 

Other problem I found is that pushing another path onto @INC by way of "use lib $new_path;" doesn't work properly. The "use lib" is executed but it only modifies @INC the first time the script is executed,  and is then ignored on succesive invocations of the same script on the same httpd process. 

The following script demonstrates the problem:
-----------------------------------------------
<%
use lib 'tmp';

$inc = join('<BR>', @INC);

%>
<P>
<%= $inc %>
-----------------------------------------------    

If you reload it some ten times (depending on the number of servers your config spawns) you'll see that the modified @INC stops showing up. 

Thanks!

Claudio.


----------------------------------------------
E-mail@stanfordalumni.org is brought to you by 
the Stanford Alumni Association and Critical Path.

Re: Apache::ASP problems with Global, global.asa, 'use lib' and @INC

Posted by Joshua Chamas <jo...@chamas.com>.
claudio.garcia@stanfordalumni.org wrote:
> 
> The problem is that I specify a dirname for the Global perl var on my httpd.conf and Apache::ASP fails to push it on @INC. This problem is circumvented if I create a global.asa file (even an empty one) in the directory I specify for the Global var. If I do this then the path is correctly pushed onto @INC.
> 
> It took me a while to discover the global.asa trick. I think this is a bug because global.asa should always be optional on ASP apps.
> 

Good point.  In my latest dev release 2.05, Global is added to @INC 
during every script compilation, just for that compilation.

> Other problem I found is that pushing another path onto @INC by way of "use lib $new_path;" doesn't work properly. The "use lib" is executed but it only modifies @INC the first time the script is executed,  and is then ignored on succesive invocations of the same script on the same httpd process.
> 

Right, this is the way modperl works.  If you want @INC
to stay a certain way, you should modify it prefork in 
the parent.  Even then, I'm not sure it'll stay that way,
test it out! 

Let me know if you want my latest dev release for Apache::ASP.
Its very stable.  I'm glad to see a fellow Cardinal working
with modperl, class '97 myself.

--Joshua