You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Kees Vonk 7249 24549 <KE...@BGTRANSCO.CO.UK> on 2000/05/18 15:43:09 UTC

Apache::PerlVINC

I am testing the use of Apache::PerlVINC but I think I must 
do something wrong because I get an error on the PerlRequire 
statement in the following bit of httpd.conf when starting 
apache:

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

PerlModule Apache::PerlVINC

<VirtualHost _default_:8443>
   DocumentRoot /opt/ward/DocumentRoot

   SetEnv IDV_ENV DEV

   Alias /idv/ "/opt/ward/IDV/DEV/Scripts"

   <Location /idv>
      Options +Indexes

      PerlAuthzHandler Ward::Authorise

      SetHandler perl-script
      PerlHandler Apache::Registry

      AuthType Basic
      AuthName "IDV Development"

      AuthAuthoritative on

      require idvenv DEV

      PerlINC /opt/ward/IDV/DEV/Modules
      PerlVersionINC on
      PerlFixupHandler Apache::PerlVINC
# This is line 341 
     PerlRequire Ward/IDV/IDVDatabase.pm
   </Location>
</VirtualHost>

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

The error I get is:

Syntax error on line 341 of /opt/ward/apache/conf/httpd.conf:
Can't locate Ward/IDV/IDVDatabase.pm in @INC (@INC contains: 
/opt/perl5/lib/5.00503/PA-RISC1.1 /opt/perl5/lib/5.00503 
/opt/perl5/lib/site_perl/PA-RISC1.1 /opt/perl5/lib/site_perl 
. /opt/ward/apache/ /opt/ward/apache/lib/perl) at 
/opt/perl5/lib/site_perl/PA-RISC1.1/Apache/PerlVINC.pm line 
41.

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

The module I am trying to access is:

/opt/ward/IDV/DEV/Modules/Ward/IDV/IDVDatabase.pm



Have I misunderstood how Apache::PerlVINC works?



Kees


Re: Apache::PerlVINC

Posted by Stas Bekman <sb...@stason.org>.
On Wed, 24 May 2000, Kees Vonk 7249 24549 wrote:

> > try this in httpd.conf:
> > 
> > <Perl>
> > delete $INC{'Apache/PerlVINC.pm'};
> > require Apache::PerlVINC;
> > </Perl>
> 
> Apache start up now (why does mod_perl not do this, can you 
> explain?), however I get the following error when trying to 
> access a page that contains the reloaded module:
> 
> ----------------
> 
> [Wed May 24 09:00:15 2000] [warn] Apache::PerlVINC: reloading 
> 'Ward/IDV/IDVDatabase.pm'
> 
> [Wed May 24 09:00:15 2000] [error] Can't locate 
> Ward/IDV/IDVDatabase.pm in @INC (@INC contains:) at 
> /opt/perl5/lib/site_perl/PA-RISC1.1/Apache/PerlVINC.pm line 
> 59.
> 
> -----------------
> 
> 
> I played around a little bit and found that I have to put the 
> PerlVersionINC directive before the PerlINC directive (which 
> makes sense looking at the code) and then that works (you 
> might want to change this in your example, (and in the guide, 
> Stas)).

Kees, thanks for the update. Will add this.

P.S. I watch the list even if I'm silent, so I pick all your notes
regarding the guide, even if I don't respond... So keep on those comming,
your contributions is what really makes the guide invaluable!

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide 
mailto:stas@stason.org   http://perl.org     http://stason.org/TULARC
http://singlesheaven.com http://perlmonth.com http://sourcegarden.org


Re: Apache::PerlVINC

Posted by Doug MacEachern <do...@covalent.net>.
On Wed, 24 May 2000, Kees Vonk 7249 24549 wrote:

> > try this in httpd.conf:
> > 
> > <Perl>
> > delete $INC{'Apache/PerlVINC.pm'};
> > require Apache::PerlVINC;
> > </Perl>
> 
> Apache start up now (why does mod_perl not do this, can you 
> explain?), 

i can't explain because i haven't been able to reproduce it yet.
actually, i can explain this:
PerlModule Apache::PerlVINC
triggers a call to: ap_add_module(&XS_Apache__PerlVINC);
which makes the command table available to apache, for PerlINC, etc.
directives.  when apache re-reads it's config at startup, it clears the
module list first.  since Apache/PerlVINC.pm is already in %INC, Perl
would not try to re-load it, hence, skipping the call to ap_add_module(),
so apache can no longer see the Apache::PerlVINC command table.  mod_perl
has logic to delete the %INC entry so it is re-loaded, but certain cases
seems to prevent that from happening.  i'm not sure what case(s) that
is yet.  the <Perl> trick forces that to happen.

> however I get the following error when trying to 
> access a page that contains the reloaded module:
... 
> I played around a little bit and found that I have to put the 
> PerlVersionINC directive before the PerlINC directive (which 
> makes sense looking at the code) and then that works (you 
> might want to change this in your example, (and in the guide, 
> Stas)).

ok thanks!
 
> Thank you very much, your help has been invaluable.

no problem, glad you've found a solution.
 
> PS. my offer of helping out mainting this module still 
> stands, I start understanding it better all the time.

ok, whenever you're ready, just say the word :) 


Re: Apache::PerlVINC

Posted by Kees Vonk 7249 24549 <KE...@BGTRANSCO.CO.UK>.
> try this in httpd.conf:
> 
> <Perl>
> delete $INC{'Apache/PerlVINC.pm'};
> require Apache::PerlVINC;
> </Perl>

Apache start up now (why does mod_perl not do this, can you 
explain?), however I get the following error when trying to 
access a page that contains the reloaded module:

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

[Wed May 24 09:00:15 2000] [warn] Apache::PerlVINC: reloading 
'Ward/IDV/IDVDatabase.pm'

[Wed May 24 09:00:15 2000] [error] Can't locate 
Ward/IDV/IDVDatabase.pm in @INC (@INC contains:) at 
/opt/perl5/lib/site_perl/PA-RISC1.1/Apache/PerlVINC.pm line 
59.

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


I played around a little bit and found that I have to put the 
PerlVersionINC directive before the PerlINC directive (which 
makes sense looking at the code) and then that works (you 
might want to change this in your example, (and in the guide, 
Stas)).


Thank you very much, your help has been invaluable.


Kees


PS. my offer of helping out mainting this module still 
stands, I start understanding it better all the time.

Re: Apache::PerlVINC

Posted by Doug MacEachern <do...@covalent.net>.
On Tue, 23 May 2000, Kees Vonk 7249 24549 wrote:
 
> Ok, I have added 'use lib qw(/opt/ward/IDV/DEV/Modules);' to my startup.pl, 
> but now I get the following error in my error log:
> 
> Syntax error on line 339 of /opt/ward/apache/conf/httpd.conf:
> Invalid command 'PerlINC', perhaps mis-spelled or defined by a module not 
> included in the server configuration

try this in httpd.conf:

<Perl>
delete $INC{'Apache/PerlVINC.pm'};
require Apache::PerlVINC;
</Perl>

mod_perl is supposed to do that for you, so the module is reloaded again
when apache re-reads it's configuration on startup.


Re: Apache::PerlVINC

Posted by Kees Vonk 7249 24549 <KE...@BGTRANSCO.CO.UK>.
> > I am testing the use of Apache::PerlVINC but I think I must 
> > do something wrong because I get an error on the PerlRequire 
> > statement in the following bit of httpd.conf when starting 
> > apache:
> 
> >       PerlINC /opt/ward/IDV/DEV/Modules
> >      PerlRequire Ward/IDV/IDVDatabase.pm
> 
> PerlINC modifies @INC at request time to pick up the different version of
> your PerlRequire'd module.  however, mod_perl needs to be able to find
> this module at startup time as well.  you'll need to 'use lib ...' or
> similar so your PerlRequire'd module can be found at startup time if it's
> not already somewhere in @INC.

Ok, I have added 'use lib qw(/opt/ward/IDV/DEV/Modules);' to my startup.pl, 
but now I get the following error in my error log:

Syntax error on line 339 of /opt/ward/apache/conf/httpd.conf:
Invalid command 'PerlINC', perhaps mis-spelled or defined by a module not 
included in the server configuration


line 339 is the PerlINC line above. I have 'PerlModule Apache::PerlVINC' in 
my httpd.conf file (I have tried moving it to startup.pl, but that doesn't 
make any difference). Relevant part of httpd.conf attached again.


Any other suggestions? Could it have something to do with my virtual host 
sections (I have more virtual host sections with Apache::PerlVINC stuff 
in)?



Kees



PS. I wouldn't mind helping out maintaining this module, but I am not sure 
I understand it 100%. (Like why is it failing in this situation.) I had a 
look at Makefile.PL and PerlVINC.pm, though I have to read up on 
DynaLoader, ExtUtils::MakeMaker and Apache::ExtUtils, I think I get the 
gist of it. For instance should PerlINC's 'errmsg' in Makefile.PL say 'a 
path' instead of 'On or Off'? But I presume that doesn't make any 
difference to my situation.




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



PerlModule Apache::PerlVINC

<VirtualHost _default_:8443>
   DocumentRoot /opt/ward/DocumentRoot

   SetEnv IDV_ENV DEV

   Alias /idv/ "/opt/ward/IDV/DEV/Scripts"

   <Location /idv>
      Options +Indexes

      PerlAuthzHandler Ward::Authorise

      SetHandler perl-script
      PerlHandler Apache::Registry

      AuthType Basic
      AuthName "IDV Development"

      AuthAuthoritative on

      require idvenv DEV

#line 339
      PerlINC /opt/ward/IDV/DEV/Modules
      PerlVersionINC On
      PerlFixupHandler Apache::PerlVINC
      PerlRequire Ward/IDV/IDVDatabase.pm
   </Location>

   ##
   ## This can also go in a <VirtualHost> section
   ##

   <IfDefine SSL>
      SSLEngine on

      SSLCertificateFile    /opt/ward/apache/conf/ssl.crt/server.crt
      SSLCertificateKeyFile /opt/ward/apache/conf/ssl.key/server.key

      SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
   </IfDefine>
</VirtualHost>


Re: Apache::PerlVINC

Posted by Doug MacEachern <do...@covalent.net>.
On Thu, 18 May 2000, Kees Vonk 7249 24549 wrote:

> I am testing the use of Apache::PerlVINC but I think I must 
> do something wrong because I get an error on the PerlRequire 
> statement in the following bit of httpd.conf when starting 
> apache:
 
>       PerlINC /opt/ward/IDV/DEV/Modules
>      PerlRequire Ward/IDV/IDVDatabase.pm

PerlINC modifies @INC at request time to pick up the different version of
your PerlRequire'd module.  however, mod_perl needs to be able to find
this module at startup time as well.  you'll need to 'use lib ...' or
similar so your PerlRequire'd module can be found at startup time if it's
not already somewhere in @INC.