You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Mark T. Dame" <md...@mfm.com> on 2000/04/11 19:15:31 UTC

Apache::ASP and @INC

Hello all.

According to the docs for Apache::ASP
(http://www.nodeworks.com/asp/config.html#Global), the Global directory
and the IncludesDir directory will be added to @INC so you can 'use' and
'require' perl modules in these directories.  This doesn't seem to be
working for me.

I have a simple ASP file:

<html>
<head>
<title>Test</title>
</head>
<body>

<%
  use TestModule;

  my $r = Apache->request;
  my $c = $r->connection;

  my $host = $c->remote_host;
  my $user = $c->user;
%>

Host: <%=$host%><br>
User: <%=$user%><br>

</body>
</html>

TestModule.pm is in /var/www/htdocs/asp.  This script fails with:

[Tue Apr 11 13:10:51 2000] [error] [asp] [12553] [error] Can't locate
TestModule.pm in @INC (@INC contains: /var/www/perllib /var/www/perllib
/var/www/perllib /usr/lib/perl5/5.00503/i386-linux
/usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux
/usr/lib/perl5/site_perl/5.005 . /usr/local/ /usr/local/lib/perl) at
(eval 187) line 8. <--> BEGIN failed--compilation aborted at (eval 187)
line 8. <--> , /usr/lib/perl5/site_perl/5.005/Apache/ASP.pm line 1180

If I add this right before the 'use TestModule;'

use lib "/var/www/htdocs/asp";

It works fine.

I'm using Apache::ASP version 0.18, perl 5.005_03, mod_perl 1.21, and
Apache version 1.3.9.

Anyone have any ideas?


-m
-- 
## Mark T. Dame:  mailto:mdame@mfm.com
## WWW:  http://www.mfm.com/~mdame/
## MFM Communication Software:  http://www.mfm.com/
"Our aim is to show the essential elements of the language in real 
 programs, but without getting bogged down in detail, rules, and 
 exceptions."
     -- The C Programming Language, Kernighan and Ritchie

Re: Apache::ASP and @INC

Posted by Joshua Chamas <jo...@chamas.com>.
Global should be added to @INC, and its always worked
for me.  Are you sure that your .htaccess is being used?
Set debugging to -2 and check out what the error_log
says for one request.  If global is set, but @INC is
not, then we really have a problem.

--Joshua

"Mark T. Dame" wrote:
> 
> "Mark T. Dame" wrote:
> >
> > Hello all.
> >
> > According to the docs for Apache::ASP
> > (http://www.nodeworks.com/asp/config.html#Global), the Global directory
> > and the IncludesDir directory will be added to @INC so you can 'use' and
> > 'require' perl modules in these directories.  This doesn't seem to be
> > working for me.
> >
> > I have a simple ASP file:
> >
> > <html>
> > <head>
> > <title>Test</title>
> > </head>
> > <body>
> >
> > <%
> >   use TestModule;
> >
> >   my $r = Apache->request;
> >   my $c = $r->connection;
> >
> >   my $host = $c->remote_host;
> >   my $user = $c->user;
> > %>
> >
> > Host: <%=$host%><br>
> > User: <%=$user%><br>
> >
> > </body>
> > </html>
> >
> > TestModule.pm is in /var/www/htdocs/asp.  This script fails with:
> >
> > [Tue Apr 11 13:10:51 2000] [error] [asp] [12553] [error] Can't locate
> > TestModule.pm in @INC (@INC contains: /var/www/perllib /var/www/perllib
> > /var/www/perllib /usr/lib/perl5/5.00503/i386-linux
> > /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux
> > /usr/lib/perl5/site_perl/5.005 . /usr/local/ /usr/local/lib/perl) at
> > (eval 187) line 8. <--> BEGIN failed--compilation aborted at (eval 187)
> > line 8. <--> , /usr/lib/perl5/site_perl/5.005/Apache/ASP.pm line 1180
> >
> > If I add this right before the 'use TestModule;'
> >
> > use lib "/var/www/htdocs/asp";
> >
> > It works fine.
> >
> > I'm using Apache::ASP version 0.18, perl 5.005_03, mod_perl 1.21, and
> > Apache version 1.3.9.
> >
> > Anyone have any ideas?
> 
> I guess I should have added my .htaccess file too.  Here's the relevant
> part:
> 
> PerlSetVar Global /var/www/htdocs/asp
> PerlSetVar StateDir /var/www/aspstate
> PerlSetVar StateDB DB_File
> PerlSetVar StatINC 1
> PerlSetVar CookiePath /
> PerlSetVar UseStrict 1
> 
> <Files ~ (\.asp)>
> SetHandler perl-script
> PerlHandler Apache::ASP
> </Files>
> 
> -m
> --
> ## Mark T. Dame:  mailto:mdame@mfm.com
> ## WWW:  http://www.mfm.com/~mdame/
> ## MFM Communication Software:  http://www.mfm.com/
> "The future has arrived; it's just not evenly distributed."
>      -- William Gibson

Re: Apache::ASP and @INC

Posted by "Mark T. Dame" <md...@mfm.com>.
"Mark T. Dame" wrote:
> 
> Hello all.
> 
> According to the docs for Apache::ASP
> (http://www.nodeworks.com/asp/config.html#Global), the Global directory
> and the IncludesDir directory will be added to @INC so you can 'use' and
> 'require' perl modules in these directories.  This doesn't seem to be
> working for me.
> 
> I have a simple ASP file:
> 
> <html>
> <head>
> <title>Test</title>
> </head>
> <body>
> 
> <%
>   use TestModule;
> 
>   my $r = Apache->request;
>   my $c = $r->connection;
> 
>   my $host = $c->remote_host;
>   my $user = $c->user;
> %>
> 
> Host: <%=$host%><br>
> User: <%=$user%><br>
> 
> </body>
> </html>
> 
> TestModule.pm is in /var/www/htdocs/asp.  This script fails with:
> 
> [Tue Apr 11 13:10:51 2000] [error] [asp] [12553] [error] Can't locate
> TestModule.pm in @INC (@INC contains: /var/www/perllib /var/www/perllib
> /var/www/perllib /usr/lib/perl5/5.00503/i386-linux
> /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux
> /usr/lib/perl5/site_perl/5.005 . /usr/local/ /usr/local/lib/perl) at
> (eval 187) line 8. <--> BEGIN failed--compilation aborted at (eval 187)
> line 8. <--> , /usr/lib/perl5/site_perl/5.005/Apache/ASP.pm line 1180
> 
> If I add this right before the 'use TestModule;'
> 
> use lib "/var/www/htdocs/asp";
> 
> It works fine.
> 
> I'm using Apache::ASP version 0.18, perl 5.005_03, mod_perl 1.21, and
> Apache version 1.3.9.
> 
> Anyone have any ideas?

I guess I should have added my .htaccess file too.  Here's the relevant
part:

PerlSetVar Global /var/www/htdocs/asp
PerlSetVar StateDir /var/www/aspstate
PerlSetVar StateDB DB_File
PerlSetVar StatINC 1
PerlSetVar CookiePath /
PerlSetVar UseStrict 1

<Files ~ (\.asp)>
SetHandler perl-script
PerlHandler Apache::ASP
</Files>


-m
-- 
## Mark T. Dame:  mailto:mdame@mfm.com
## WWW:  http://www.mfm.com/~mdame/
## MFM Communication Software:  http://www.mfm.com/
"The future has arrived; it's just not evenly distributed."
     -- William Gibson